public inbox for [email protected]
help / color / mirror / Atom feedFrom: Nathan Bossart <[email protected]>
Subject: [PATCH v8 4/5] refactor autovacuum subroutine in preparation for system view
Date: Thu, 2 Apr 2026 14:17:11 -0500
---
src/backend/postmaster/autovacuum.c | 44 ++++++++++++++++-------------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 12c205e57ea..9ccd1861328 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -370,10 +370,12 @@ static void FreeWorkerInfo(int code, Datum arg);
static autovac_table *table_recheck_autovac(Oid relid, HTAB *table_toast_map,
TupleDesc pg_class_desc,
int effective_multixact_freeze_max_age);
-static void recheck_relation_needs_vacanalyze(Oid relid, AutoVacOpts *avopts,
- Form_pg_class classForm,
- int effective_multixact_freeze_max_age,
- bool *dovacuum, bool *doanalyze, bool *wraparound);
+static void compute_autovacuum_scores(Oid relid, AutoVacOpts *avopts,
+ Form_pg_class classForm,
+ int effective_multixact_freeze_max_age,
+ int elevel,
+ bool *dovacuum, bool *doanalyze, bool *wraparound,
+ AutoVacuumScores *scores);
static void relation_needs_vacanalyze(Oid relid, AutoVacOpts *relopts,
Form_pg_class classForm,
PgStat_StatTabEntry *tabentry,
@@ -2834,6 +2836,7 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
bool wraparound;
AutoVacOpts *avopts;
bool free_avopts = false;
+ AutoVacuumScores scores;
/* fetch the relation's relcache entry */
classTup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
@@ -2859,9 +2862,11 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
avopts = &hentry->ar_reloptions;
}
- recheck_relation_needs_vacanalyze(relid, avopts, classForm,
- effective_multixact_freeze_max_age,
- &dovacuum, &doanalyze, &wraparound);
+ compute_autovacuum_scores(relid, avopts, classForm,
+ effective_multixact_freeze_max_age,
+ DEBUG3,
+ &dovacuum, &doanalyze, &wraparound,
+ &scores);
/* OK, it needs something done */
if (doanalyze || dovacuum)
@@ -2971,24 +2976,23 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
}
/*
- * recheck_relation_needs_vacanalyze
- *
- * Subroutine for table_recheck_autovac.
+ * compute_autovacuum_scores
*
* Fetch the pgstat of a relation and recheck whether a relation
* needs to be vacuumed or analyzed.
*/
static void
-recheck_relation_needs_vacanalyze(Oid relid,
- AutoVacOpts *avopts,
- Form_pg_class classForm,
- int effective_multixact_freeze_max_age,
- bool *dovacuum,
- bool *doanalyze,
- bool *wraparound)
+compute_autovacuum_scores(Oid relid,
+ AutoVacOpts *avopts,
+ Form_pg_class classForm,
+ int effective_multixact_freeze_max_age,
+ int elevel,
+ bool *dovacuum,
+ bool *doanalyze,
+ bool *wraparound,
+ AutoVacuumScores *scores)
{
PgStat_StatTabEntry *tabentry;
- AutoVacuumScores scores;
/* fetch the pgstat table entry */
tabentry = pgstat_fetch_stat_tabentry_ext(classForm->relisshared,
@@ -2996,9 +3000,9 @@ recheck_relation_needs_vacanalyze(Oid relid,
relation_needs_vacanalyze(relid, avopts, classForm, tabentry,
effective_multixact_freeze_max_age,
- DEBUG3,
+ elevel,
dovacuum, doanalyze, wraparound,
- &scores);
+ scores);
/* Release tabentry to avoid leakage */
if (tabentry)
--
2.50.1 (Apple Git-155)
--/vKBiHkEvphli8Mi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v8-0005-add-pg_stat_autovacuum_scores-system-view.patch
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [PATCH v8 4/5] refactor autovacuum subroutine in preparation for system view
In-Reply-To: <no-message-id-601575@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox