Skip to content

Commit 49f49de

Browse files
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 b4af70c 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.
1 parent b4af70c commit 49f49de

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/backend/access/heap/vacuumlazy.c

+7
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ typedef struct LVShared
194194
Oid relid;
195195
int elevel;
196196

197+
/*
198+
* Buffer access strategy from leader
199+
*/
200+
BufferAccessStrategy bstrategy;
201+
197202
/*
198203
* An indication for vacuum workers to perform either index vacuum or
199204
* index cleanup. first_time is true only if for_cleanup is true and
@@ -3480,6 +3485,7 @@ begin_parallel_vacuum(LVRelState *vacrel, BlockNumber nblocks,
34803485
MemSet(shared, 0, est_shared);
34813486
shared->relid = RelationGetRelid(vacrel->rel);
34823487
shared->elevel = elevel;
3488+
shared->bstrategy = vacrel->bstrategy;
34833489
shared->maintenance_work_mem_worker =
34843490
(nindexes_mwm > 0) ?
34853491
maintenance_work_mem / Min(parallel_workers, nindexes_mwm) :
@@ -3720,6 +3726,7 @@ parallel_vacuum_main(dsm_segment *seg, shm_toc *toc)
37203726
vacrel.rel = rel;
37213727
vacrel.indrels = indrels;
37223728
vacrel.nindexes = nindexes;
3729+
vacrel.bstrategy = lvshared->bstrategy;
37233730
vacrel.indstats = (IndexBulkDeleteResult **)
37243731
palloc0(nindexes * sizeof(IndexBulkDeleteResult *));
37253732

0 commit comments

Comments
 (0)