agora inbox for [email protected]  
help / color / mirror / Atom feed
Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM
795+ messages / 4 participants
[nested] [flat]

* Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM
@ 2020-08-01 18:30 Peter Geoghegan <[email protected]>
  2020-08-01 21:22 ` Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM Daniel Gustafsson <[email protected]>
  2020-08-02 16:07 ` Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM Michail Nikolaev <[email protected]>
  0 siblings, 2 replies; 795+ messages in thread

From: Peter Geoghegan @ 2020-08-01 18:30 UTC (permalink / raw)
  To: Michail Nikolaev <[email protected]>; +Cc: pgsql-hackers

On Mon, Mar 16, 2020 at 7:08 AM Michail Nikolaev
<[email protected]> wrote:
> While working on support for index hint bits on standby [1] I have
> started to getting
> "ERROR:  could not find left sibling of block XXXX in index XXXX"
> during stress tests.

I reproduced the bug using your steps (including the pg_usleep() hack)
today. It was fairly easy to confirm the problem.

Attached is a revised version of your patch. It renames the buffer
variable names, and changes the precise order in which the locks are
released (for consistency with _bt_unlink_halfdead_page()). It also
changes the comments, and adds a new paragraph to the README. The
existing paragraph was about cross-level differences, this new one is
about same-level differences (plus a second new paragraph to talk
about backwards scans + page deletion).

This revised version is essentially the same as your original patch --
I have only made superficial adjuments. I think that I will be able to
commit this next week, barring objections.

--
Peter Geoghegan


Attachments:

  [application/octet-stream] v3-0001-Avoid-backwards-scan-page-deletion-standby-race.patch (7.0K, ../../CAH2-Wz=1RLqEn-cvGUincCX+ji9Yk-tWzLyB_kmoxJpkS+v-xw@mail.gmail.com/2-v3-0001-Avoid-backwards-scan-page-deletion-standby-race.patch)
  download | inline diff:
From c225826208c31a980e41e1fad0298bb552f6114c Mon Sep 17 00:00:00 2001
From: Peter Geoghegan <[email protected]>
Date: Fri, 31 Jul 2020 16:57:35 -0700
Subject: [PATCH v3] Avoid backwards scan page deletion standby race.

Author: Michail Nikolaev
Discussion: https://postgr.es/m/CANtu0ohkR-evAWbpzJu54V8eCOtqjJyYp3PQ_SGoBTRGXWhWRw@mail.gmail.com
---
 src/backend/access/nbtree/README    | 18 ++++++
 src/backend/access/nbtree/nbtxlog.c | 85 ++++++++++++++++++-----------
 2 files changed, 70 insertions(+), 33 deletions(-)

diff --git a/src/backend/access/nbtree/README b/src/backend/access/nbtree/README
index 32ad9e339a..a08c3de3f3 100644
--- a/src/backend/access/nbtree/README
+++ b/src/backend/access/nbtree/README
@@ -572,6 +572,24 @@ replay of page deletion records does not hold a write lock on the target
 leaf page throughout; only the primary needs to block out concurrent
 writers that insert on to the page being deleted.)
 
+There are also locking differences between the primary and WAL replay
+for the first stage of a page split (i.e. same-level differences in
+locking).  Replay of the first phase of a page split can get away with
+locking and updating the original right sibling page (which is also the
+new right sibling page's right sibling) after locks on the original page
+and its new right sibling have been released.  Again, this is okay
+because there are no writers.  Page deletion cannot get away with being
+lax about same-level locking during replay, though -- doing so risks
+confusing concurrent backwards scans.
+
+Page deletion's second phase locks the left sibling page, target page,
+and right page in order on the standby, just like on the primary.  This
+allows backwards scans running on a standby to reason about page
+deletion on the leaf level; a page cannot appear deleted without that
+being reflected in the sibling pages.  It's probably possible to be more
+lax about how locks are acquired on the standby during the second phase
+of page deletion, but that hardly seems worth it.
+
 During recovery all index scans start with ignore_killed_tuples = false
 and we never set kill_prior_tuple. We do this because the oldest xmin
 on the standby server can be older than the oldest xmin on the primary
diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c
index 5d346da84f..8e46437dbe 100644
--- a/src/backend/access/nbtree/nbtxlog.c
+++ b/src/backend/access/nbtree/nbtxlog.c
@@ -774,7 +774,10 @@ btree_xlog_unlink_page(uint8 info, XLogReaderState *record)
 	xl_btree_unlink_page *xlrec = (xl_btree_unlink_page *) XLogRecGetData(record);
 	BlockNumber leftsib;
 	BlockNumber rightsib;
-	Buffer		buffer;
+	Buffer		leftbuf;
+	Buffer		target;
+	Buffer		rightbuf;
+	Buffer		leafbuf;
 	Page		page;
 	BTPageOpaque pageop;
 
@@ -783,46 +786,38 @@ btree_xlog_unlink_page(uint8 info, XLogReaderState *record)
 
 	/*
 	 * In normal operation, we would lock all the pages this WAL record
-	 * touches before changing any of them.  In WAL replay, it should be okay
-	 * to lock just one page at a time, since no concurrent index updates can
-	 * be happening, and readers should not care whether they arrive at the
-	 * target page or not (since it's surely empty).
+	 * touches before changing any of them.  In WAL replay, we at least lock
+	 * the pages in the same standard left-to-right order (leftsib, target,
+	 * rightsib).
+	 *
+	 * btree_xlog_split() can get away with fixing its right sibling page's
+	 * left link last of all, after dropping all other locks.  We prefer to
+	 * avoid dropping locks on same-level pages early compared to normal
+	 * operation.  This keeps things simple for backwards scans.  See
+	 * nbtree/README.
 	 */
 
-	/* Fix left-link of right sibling */
-	if (XLogReadBufferForRedo(record, 2, &buffer) == BLK_NEEDS_REDO)
-	{
-		page = (Page) BufferGetPage(buffer);
-		pageop = (BTPageOpaque) PageGetSpecialPointer(page);
-		pageop->btpo_prev = leftsib;
-
-		PageSetLSN(page, lsn);
-		MarkBufferDirty(buffer);
-	}
-	if (BufferIsValid(buffer))
-		UnlockReleaseBuffer(buffer);
-
 	/* Fix right-link of left sibling, if any */
 	if (leftsib != P_NONE)
 	{
-		if (XLogReadBufferForRedo(record, 1, &buffer) == BLK_NEEDS_REDO)
+		if (XLogReadBufferForRedo(record, 1, &leftbuf) == BLK_NEEDS_REDO)
 		{
-			page = (Page) BufferGetPage(buffer);
+			page = (Page) BufferGetPage(leftbuf);
 			pageop = (BTPageOpaque) PageGetSpecialPointer(page);
 			pageop->btpo_next = rightsib;
 
 			PageSetLSN(page, lsn);
-			MarkBufferDirty(buffer);
+			MarkBufferDirty(leftbuf);
 		}
-		if (BufferIsValid(buffer))
-			UnlockReleaseBuffer(buffer);
 	}
+	else
+		leftbuf = InvalidBuffer;
 
 	/* Rewrite target page as empty deleted page */
-	buffer = XLogInitBufferForRedo(record, 0);
-	page = (Page) BufferGetPage(buffer);
+	target = XLogInitBufferForRedo(record, 0);
+	page = (Page) BufferGetPage(target);
 
-	_bt_pageinit(page, BufferGetPageSize(buffer));
+	_bt_pageinit(page, BufferGetPageSize(target));
 	pageop = (BTPageOpaque) PageGetSpecialPointer(page);
 
 	pageop->btpo_prev = leftsib;
@@ -832,8 +827,27 @@ btree_xlog_unlink_page(uint8 info, XLogReaderState *record)
 	pageop->btpo_cycleid = 0;
 
 	PageSetLSN(page, lsn);
-	MarkBufferDirty(buffer);
-	UnlockReleaseBuffer(buffer);
+	MarkBufferDirty(target);
+
+	/* Fix left-link of right sibling */
+	if (XLogReadBufferForRedo(record, 2, &rightbuf) == BLK_NEEDS_REDO)
+	{
+		page = (Page) BufferGetPage(rightbuf);
+		pageop = (BTPageOpaque) PageGetSpecialPointer(page);
+		pageop->btpo_prev = leftsib;
+
+		PageSetLSN(page, lsn);
+		MarkBufferDirty(rightbuf);
+	}
+
+	/* Release siblings */
+	if (BufferIsValid(leftbuf))
+		UnlockReleaseBuffer(leftbuf);
+	if (BufferIsValid(rightbuf))
+		UnlockReleaseBuffer(rightbuf);
+
+	/* Release target */
+	UnlockReleaseBuffer(target);
 
 	/*
 	 * If we deleted a parent of the targeted leaf page, instead of the leaf
@@ -845,13 +859,18 @@ btree_xlog_unlink_page(uint8 info, XLogReaderState *record)
 		/*
 		 * There is no real data on the page, so we just re-create it from
 		 * scratch using the information from the WAL record.
+		 *
+		 * Note that we don't end up here when the target page is also the
+		 * leafbuf page.  There is no need to add a dummy hikey item with a
+		 * top parent link when deleting leafbuf because it's the last page
+		 * we'll delete in the subtree undergoing deletion.
 		 */
 		IndexTupleData trunctuple;
 
-		buffer = XLogInitBufferForRedo(record, 3);
-		page = (Page) BufferGetPage(buffer);
+		leafbuf = XLogInitBufferForRedo(record, 3);
+		page = (Page) BufferGetPage(leafbuf);
 
-		_bt_pageinit(page, BufferGetPageSize(buffer));
+		_bt_pageinit(page, BufferGetPageSize(leafbuf));
 		pageop = (BTPageOpaque) PageGetSpecialPointer(page);
 
 		pageop->btpo_flags = BTP_HALF_DEAD | BTP_LEAF;
@@ -870,8 +889,8 @@ btree_xlog_unlink_page(uint8 info, XLogReaderState *record)
 			elog(ERROR, "could not add dummy high key to half-dead page");
 
 		PageSetLSN(page, lsn);
-		MarkBufferDirty(buffer);
-		UnlockReleaseBuffer(buffer);
+		MarkBufferDirty(leafbuf);
+		UnlockReleaseBuffer(leafbuf);
 	}
 
 	/* Update metapage if needed */
-- 
2.25.1



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

* Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM
  2020-08-01 18:30 Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM Peter Geoghegan <[email protected]>
@ 2020-08-01 21:22 ` Daniel Gustafsson <[email protected]>
  1 sibling, 0 replies; 795+ messages in thread

From: Daniel Gustafsson @ 2020-08-01 21:22 UTC (permalink / raw)
  To: Peter Geoghegan <[email protected]>; +Cc: Michail Nikolaev <[email protected]>; pgsql-hackers

> On 1 Aug 2020, at 20:30, Peter Geoghegan <[email protected]> wrote:

> This revised version is essentially the same as your original patch --
> I have only made superficial adjuments. I think that I will be able to
> commit this next week, barring objections.

As we're out of time for the July CF where this is registered, I've moved this
to 2020-09.  Based on the above comment, I've marked it Ready for Committer.

cheers ./daniel




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

* Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM
  2020-08-01 18:30 Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM Peter Geoghegan <[email protected]>
@ 2020-08-02 16:07 ` Michail Nikolaev <[email protected]>
  2020-08-03 22:55   ` Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM Peter Geoghegan <[email protected]>
  1 sibling, 1 reply; 795+ messages in thread

From: Michail Nikolaev @ 2020-08-02 16:07 UTC (permalink / raw)
  To: Peter Geoghegan <[email protected]>; +Cc: pgsql-hackers

Hello, Peter.

> Attached is a revised version of your patch
Thanks for your work, the patch is looking better now.

Michail.





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

* Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM
  2020-08-01 18:30 Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM Peter Geoghegan <[email protected]>
  2020-08-02 16:07 ` Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM Michail Nikolaev <[email protected]>
@ 2020-08-03 22:55   ` Peter Geoghegan <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Peter Geoghegan @ 2020-08-03 22:55 UTC (permalink / raw)
  To: Michail Nikolaev <[email protected]>; +Cc: pgsql-hackers

On Sun, Aug 2, 2020 at 9:07 AM Michail Nikolaev
<[email protected]> wrote:
> Thanks for your work, the patch is looking better now.

Pushed -- thanks!

-- 
Peter Geoghegan





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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 795+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 795+ messages in thread


end of thread, other threads:[~2025-06-23 20:16 UTC | newest]

Thread overview: 795+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01 18:30 Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM Peter Geoghegan <[email protected]>
2020-08-01 21:22 ` Daniel Gustafsson <[email protected]>
2020-08-02 16:07 ` Michail Nikolaev <[email protected]>
2020-08-03 22:55   ` Peter Geoghegan <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: 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