diff options
author | Peter Geoghegan <pg@bowt.ie> | 2021-04-05 14:56:56 -0700 |
---|---|---|
committer | Peter Geoghegan <pg@bowt.ie> | 2021-04-05 14:56:56 -0700 |
commit | 49f49defe7c0a330cca084de5da14ccdfdafc6a3 (patch) | |
tree | 172d422da2e98f695d6c01d10642b6306d2114ac | |
parent | b4af70cb210393c9c8f41643acf6b213e21178e7 (diff) | |
download | postgresql-49f49defe7c0a330cca084de5da14ccdfdafc6a3.tar.gz postgresql-49f49defe7c0a330cca084de5da14ccdfdafc6a3.zip |
Propagate parallel VACUUM's buffer access strategy.
Parallel VACUUM relied on global variable state from the leader process
being propagated to workers on fork(). Commit b4af70cb removed most
uses of global variables inside vacuumlazy.c, but did not account for
the buffer access strategy state.
To fix, propagate the state through shared memory instead.
Per buildfarm failures on elver, curculio, and morepork.
Many thanks to Thomas Munro for off-list assistance with this issue.
-rw-r--r-- | src/backend/access/heap/vacuumlazy.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index cc98ede5394..0763ed85d0c 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -195,6 +195,11 @@ typedef struct LVShared int elevel; /* + * Buffer access strategy from leader + */ + BufferAccessStrategy bstrategy; + + /* * An indication for vacuum workers to perform either index vacuum or * index cleanup. first_time is true only if for_cleanup is true and * bulk-deletion is not performed yet. @@ -3480,6 +3485,7 @@ begin_parallel_vacuum(LVRelState *vacrel, BlockNumber nblocks, MemSet(shared, 0, est_shared); shared->relid = RelationGetRelid(vacrel->rel); shared->elevel = elevel; + shared->bstrategy = vacrel->bstrategy; shared->maintenance_work_mem_worker = (nindexes_mwm > 0) ? maintenance_work_mem / Min(parallel_workers, nindexes_mwm) : @@ -3720,6 +3726,7 @@ parallel_vacuum_main(dsm_segment *seg, shm_toc *toc) vacrel.rel = rel; vacrel.indrels = indrels; vacrel.nindexes = nindexes; + vacrel.bstrategy = lvshared->bstrategy; vacrel.indstats = (IndexBulkDeleteResult **) palloc0(nindexes * sizeof(IndexBulkDeleteResult *)); |