aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2021-04-12 09:03:16 +0530
committerAmit Kapila <akapila@postgresql.org>2021-04-12 09:03:16 +0530
commit48d4a8c88ba73c5e68461d1ced9090ac33827028 (patch)
tree22fbe2233bc85ce525cfeef32cf77c33b972f4a6 /src
parentbe79debd9688da516f49ba9b825ee2e784d1fab0 (diff)
downloadpostgresql-48d4a8c88ba73c5e68461d1ced9090ac33827028.tar.gz
postgresql-48d4a8c88ba73c5e68461d1ced9090ac33827028.zip
Allocate access strategy in parallel VACUUM workers.
Currently, parallel vacuum workers don't use any buffer access strategy. We can fix it either by propagating the access strategy from a leader or allow each worker to use BAS_VACUUM access strategy type. We don't see much use in propagating this information from leader as both leader and workers are supposed to use the same strategy. We might want to use a different access strategy for leader and workers but that would be a separate optimization not suitable for back-branches. This has been fixed in HEAD as commit f6b8f19a08. Author: Amit Kapila Reviewed-by: Sawada Masahiko, Bharath Rupireddy Discussion: https://postgr.es/m/CAA4eK1KbmJgRV2W3BbzRnKUSrukN7SbqBBriC4RDB5KBhopkGQ@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/heap/vacuumlazy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index d6a8cf390c2..fe2a6062b9c 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -3510,6 +3510,9 @@ parallel_vacuum_main(dsm_segment *seg, shm_toc *toc)
vac_open_indexes(onerel, RowExclusiveLock, &nindexes, &indrels);
Assert(nindexes > 0);
+ /* Each parallel VACUUM worker gets its own access strategy */
+ vac_strategy = GetAccessStrategy(BAS_VACUUM);
+
/* Set dead tuple space */
dead_tuples = (LVDeadTuples *) shm_toc_lookup(toc,
PARALLEL_VACUUM_KEY_DEAD_TUPLES,
@@ -3564,6 +3567,7 @@ parallel_vacuum_main(dsm_segment *seg, shm_toc *toc)
vac_close_indexes(nindexes, indrels, RowExclusiveLock);
table_close(onerel, ShareUpdateExclusiveLock);
+ FreeAccessStrategy(vac_strategy);
pfree(stats);
}