agora inbox for [email protected]help / color / mirror / Atom feed
Why is libcurses added to build by configure? 795+ messages / 6 participants [nested] [flat]
* Why is libcurses added to build by configure? @ 1998-10-30 23:54 Tom Lane <[email protected]> 0 siblings, 4 replies; 795+ messages in thread From: Tom Lane @ 1998-10-30 23:54 UTC (permalink / raw) To: pgsql-hackers Does anyone understand why configure.in wants to include libcurses in $(LIBS) ? There is no program in the PostgreSQL distribution that uses that library (at least, I could not find any reference to curses.h). On HPUX 10, including libcurses causes problems because it defines a select() routine that has nothing to do with the select() system call. There is a hack in Makefile.hpux that gets around this (by linking -lc ahead of the libraries chosen by configure), but that is going to cause problems for supporting HPUX 10.01, because signal considerations demand that -lBSD come first on that platform. I would like to pull out the configure.in code that adds -lcurses to LIBS, but I'm hesitant to do it at this late stage in the release cycle without knowing why it was there in the first place. Did we use to have a frontend that used curses, or something like that? regards, tom lane ^ permalink raw reply [nested|flat] 795+ messages in thread
* Re: [HACKERS] Why is libcurses added to build by configure? @ 1998-10-31 03:16 The Hermit Hacker <[email protected]> parent: Tom Lane <[email protected]> 3 siblings, 0 replies; 795+ messages in thread From: The Hermit Hacker @ 1998-10-31 03:16 UTC (permalink / raw) To: Tom Lane <[email protected]>; +Cc: pgsql-hackers On Fri, 30 Oct 1998, Tom Lane wrote: > Does anyone understand why configure.in wants to include libcurses in > $(LIBS) ? There is no program in the PostgreSQL distribution that uses > that library (at least, I could not find any reference to curses.h). > > On HPUX 10, including libcurses causes problems because it defines a > select() routine that has nothing to do with the select() system call. > There is a hack in Makefile.hpux that gets around this (by linking -lc > ahead of the libraries chosen by configure), but that is going to cause > problems for supporting HPUX 10.01, because signal considerations demand > that -lBSD come first on that platform. > > I would like to pull out the configure.in code that adds -lcurses to > LIBS, but I'm hesitant to do it at this late stage in the release cycle > without knowing why it was there in the first place. Did we use to have > a frontend that used curses, or something like that? Good stuff, you are learning...do not pull anything out, period. Don't add anything in, period. There was a reason for it, but it was sooooo long ago that I don't recall what it was. It has worked up until now, and if only HPUX 10.01 is reporting a problem with it...leave it. Mark it as un-supported at this time, and work at fixing it post-release. Marc G. Fournier Systems Administrator @ hub.org primary: [email protected] secondary: scrappy@{freebsd|postgresql}.org ^ permalink raw reply [nested|flat] 795+ messages in thread
* RE: [HACKERS] Why is libcurses added to build by configure? @ 1998-10-31 03:33 Vince Vielhaber <[email protected]> parent: Tom Lane <[email protected]> 3 siblings, 0 replies; 795+ messages in thread From: Vince Vielhaber @ 1998-10-31 03:33 UTC (permalink / raw) To: Tom Lane <[email protected]>; +Cc: pgsql-hackers On 30-Oct-98 Tom Lane wrote: > Does anyone understand why configure.in wants to include libcurses in > $(LIBS) ? There is no program in the PostgreSQL distribution that uses > that library (at least, I could not find any reference to curses.h). I'm guessing here, but could it be a replacement for things like readline? I know old OS versions could have any number of things stuck to it, and after some of the things I've seen HP-UX do over the years, nothing really surprises me anymore. > > On HPUX 10, including libcurses causes problems because it defines a > select() routine that has nothing to do with the select() system call. > There is a hack in Makefile.hpux that gets around this (by linking -lc > ahead of the libraries chosen by configure), but that is going to cause > problems for supporting HPUX 10.01, because signal considerations demand > that -lBSD come first on that platform. > > I would like to pull out the configure.in code that adds -lcurses to > LIBS, but I'm hesitant to do it at this late stage in the release cycle > without knowing why it was there in the first place. Did we use to have > a frontend that used curses, or something like that? How wise would that be at this time? That may be something to do at a time like a minor version release. Vince. -- ========================================================================== Vince Vielhaber -- KA8CSH email: [email protected] flame-mail: /dev/null # include <std/disclaimers.h> TEAM-OS2 Online Searchable Campground Listings http://www.camping-usa.com "There is no outfit less entitled to lecture me about bloat than the federal government" -- Tony Snow ========================================================================== ^ permalink raw reply [nested|flat] 795+ messages in thread
* Re: [HACKERS] Why is libcurses added to build by configure? @ 1998-10-31 03:36 Thomas G. Lockhart <[email protected]> parent: Tom Lane <[email protected]> 3 siblings, 0 replies; 795+ messages in thread From: Thomas G. Lockhart @ 1998-10-31 03:36 UTC (permalink / raw) To: Tom Lane <[email protected]>; +Cc: pgsql-hackers > I would like to pull out the configure.in code that adds -lcurses to > LIBS, but I'm hesitant to do it at this late stage in the release > cycle without knowing why it was there in the first place. Yup. I think we are pretty much frozen by now. Seems like a v6.5 thing since it may have effects on other platforms. - Tom ^ permalink raw reply [nested|flat] 795+ messages in thread
* RE: [HACKERS] Why is libcurses added to build by configure? @ 1998-10-31 11:30 Karl Auer <[email protected]> parent: Tom Lane <[email protected]> 3 siblings, 1 reply; 795+ messages in thread From: Karl Auer @ 1998-10-31 11:30 UTC (permalink / raw) To: Tom Lane <[email protected]>; +Cc: pgsql-hackers psql (at least in 6.3.2) uses curses and readline. I know this because I tried to compile under a SuSE 5.3 distribution. Configure couldn't find the curses library, so it wasn't added to LIBS, so the linker didn't try to use it, so psql had unresolved references, all of which seems to indicate (even without reading the sources) that *something* in there wants curses. I.e., it's not just configure. Interestingly, failing to find curses did NOT stop configure, it went on to make everything. "make all" didn't stop when psql failed to build either - it went on to report all well at the end. Not until "make install" did the failure become evident (though it was logged of course). Regards, K. Am 30-Oct-98 schrieb Tom Lane: > Does anyone understand why configure.in wants to include libcurses in > $(LIBS) ? There is no program in the PostgreSQL distribution that uses > that library (at least, I could not find any reference to curses.h). > > On HPUX 10, including libcurses causes problems because it defines a > select() routine that has nothing to do with the select() system call. > There is a hack in Makefile.hpux that gets around this (by linking -lc > ahead of the libraries chosen by configure), but that is going to cause > problems for supporting HPUX 10.01, because signal considerations demand > that -lBSD come first on that platform. > > I would like to pull out the configure.in code that adds -lcurses to > LIBS, but I'm hesitant to do it at this late stage in the release cycle > without knowing why it was there in the first place. Did we use to have > a frontend that used curses, or something like that? > > regards, tom lane > --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Karl Auer ([email protected]) Geschaeft/work +41-1-6327531 Kommunikation, ETHZ RZ Privat/home +41-1-4517941 Clausiusstrasse 59 Fax +41-1-6321225 CH-8092 ZUERICH Switzerland ^ permalink raw reply [nested|flat] 795+ messages in thread
* Re: [HACKERS] Why is libcurses added to build by configure? @ 1998-10-31 17:44 Tom Lane <[email protected]> parent: Karl Auer <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Tom Lane @ 1998-10-31 17:44 UTC (permalink / raw) To: [email protected]; +Cc: pgsql-hackers Karl Auer <[email protected]> writes: > psql (at least in 6.3.2) uses curses and readline. I know this because > I tried to compile under a SuSE 5.3 distribution. Hmm. psql does use readline, but there's no direct dependency on curses. (I verified this by building without curses; it works, here.) Perhaps there are some implementations of readline that depend on curses? The GNU libreadline I have here appears to use termcap, but not curses. There might be other versions though. I think it would be possible to extend configure to detect which library(s) libreadline depends on, and only include those in the link. But that's not something to risk at this stage... regards, tom lane ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 795+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 795+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=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 -- 1998-10-30 23:54 Why is libcurses added to build by configure? Tom Lane <[email protected]> 1998-10-31 03:16 ` The Hermit Hacker <[email protected]> 1998-10-31 03:33 ` Vince Vielhaber <[email protected]> 1998-10-31 03:36 ` Thomas G. Lockhart <[email protected]> 1998-10-31 11:30 ` Karl Auer <[email protected]> 1998-10-31 17:44 ` Tom Lane <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: 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