V5_0003-Setup-counters-for-parallel-vacuums.patch
text/x-patch
Filename: V5_0003-Setup-counters-for-parallel-vacuums.patch
Type: text/x-patch
Part: 2
Message:
Re: Logging parallel worker draught
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0003
Subject: Setup counters for parallel vacuums
| File | + | − |
|---|---|---|
| src/backend/commands/vacuumparallel.c | 9 | 0 |
From 477b08125e4131b2199ad7c38560c6ce3a0f63fd Mon Sep 17 00:00:00 2001 From: benoit <benoit.lobreau@dalibo.com> Date: Fri, 11 Oct 2024 23:56:23 +0200 Subject: [PATCH 3/5] Setup counters for parallel vacuums Thsi can be used bu other patches such as the one for pg_stat_database. --- src/backend/commands/vacuumparallel.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/backend/commands/vacuumparallel.c b/src/backend/commands/vacuumparallel.c index 67cba17a56..7094c80dc6 100644 --- a/src/backend/commands/vacuumparallel.c +++ b/src/backend/commands/vacuumparallel.c @@ -208,6 +208,9 @@ struct ParallelVacuumState int nindexes_parallel_cleanup; int nindexes_parallel_condcleanup; + int nworkers_to_launch; + int nworkers_launched; + /* Buffer access strategy used by leader process */ BufferAccessStrategy bstrategy; @@ -362,6 +365,9 @@ parallel_vacuum_init(Relation rel, Relation *indrels, int nindexes, if ((vacoptions & VACUUM_OPTION_PARALLEL_COND_CLEANUP) != 0) pvs->nindexes_parallel_condcleanup++; } + pvs->nworkers_to_launch = 0; + pvs->nworkers_launched = 0; + shm_toc_insert(pcxt->toc, PARALLEL_VACUUM_KEY_INDEX_STATS, indstats); pvs->indstats = indstats; @@ -738,6 +744,9 @@ parallel_vacuum_process_all_indexes(ParallelVacuumState *pvs, int num_index_scan for (int i = 0; i < pvs->pcxt->nworkers_launched; i++) InstrAccumParallelQuery(&pvs->buffer_usage[i], &pvs->wal_usage[i]); + + pvs->nworkers_to_launch += pvs->pcxt->nworkers_to_launch; + pvs->nworkers_launched += pvs->pcxt->nworkers_launched; } /* -- 2.47.0