Skip to content

Commit 5ec83f9

Browse files
bloghCommitfest Bot
authored and
Commitfest Bot
committed
Setup counters for parallel vacuums
This can be used by other patches such as the one for pg_stat_database.
1 parent b8e288f commit 5ec83f9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/backend/commands/vacuumparallel.c

+9
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ struct ParallelVacuumState
208208
int nindexes_parallel_cleanup;
209209
int nindexes_parallel_condcleanup;
210210

211+
int nworkers_to_launch;
212+
int nworkers_launched;
213+
211214
/* Buffer access strategy used by leader process */
212215
BufferAccessStrategy bstrategy;
213216

@@ -362,6 +365,9 @@ parallel_vacuum_init(Relation rel, Relation *indrels, int nindexes,
362365
if ((vacoptions & VACUUM_OPTION_PARALLEL_COND_CLEANUP) != 0)
363366
pvs->nindexes_parallel_condcleanup++;
364367
}
368+
pvs->nworkers_to_launch = 0;
369+
pvs->nworkers_launched = 0;
370+
365371
shm_toc_insert(pcxt->toc, PARALLEL_VACUUM_KEY_INDEX_STATS, indstats);
366372
pvs->indstats = indstats;
367373

@@ -738,6 +744,9 @@ parallel_vacuum_process_all_indexes(ParallelVacuumState *pvs, int num_index_scan
738744

739745
for (int i = 0; i < pvs->pcxt->nworkers_launched; i++)
740746
InstrAccumParallelQuery(&pvs->buffer_usage[i], &pvs->wal_usage[i]);
747+
748+
pvs->nworkers_to_launch += pvs->pcxt->nworkers_to_launch;
749+
pvs->nworkers_launched += pvs->pcxt->nworkers_launched;
741750
}
742751

743752
/*

0 commit comments

Comments
 (0)