Commit 49f49def authored by Peter Geoghegan's avatar Peter Geoghegan

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.
parent b4af70cb
......@@ -194,6 +194,11 @@ typedef struct LVShared
Oid relid;
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
......@@ -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 *));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment