Fix parallel autovacuum workers ignoring track_cost_delay_timing changes.

Commit 1ff3180ca01 made the leader of a parallel autovacuum propagate
changes to the cost-based delay parameters to its workers, but missed
track_cost_delay_timing. Workers therefore kept the value they had at
launch: turning the parameter on during the vacuum left
pg_stat_progress_vacuum.delay_time counting only the leader's naps,
and turning it off didn't stop workers from adding theirs. Throttling
itself was not affected.

Fix by adding track_cost_delay_timing to PVSharedCostParams. Since a
worker's setting can now change while it runs, we report its residual
delay time at exit whenever any has been accumulated, rather than only
if track_cost_delay_timing is still on.

Backpatch to v19, where parallel autovacuum was introduced.

Reported-by: Sami Imseih <[email protected]>
Author: Sami Imseih <[email protected]>
Reviewed-by: Bharath Rupireddy <[email protected]>
Reviewed-by: Zsolt Parragi <[email protected]>
Reviewed-by: Masahiko Sawada <[email protected]>
Discussion: 
https://postgr.es/m/can12+yjzaald3zmekvvrtwcuy5_ydtr_vmpwwc8qngeyxrn...@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fb112cbf748c004ec0cee0ad49a1e7823c7091e0

Modified Files
--------------
src/backend/commands/vacuumparallel.c                       | 13 +++++++++----
.../modules/test_autovacuum/t/001_parallel_autovacuum.pl    |  3 ++-
2 files changed, 11 insertions(+), 5 deletions(-)

Reply via email to