pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Refresh autovacuum costs while waiting for parallel workers.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Refresh autovacuum costs while waiting for parallel workers.
@ 2026-10-01 13:20  Masahiko Sawada <msawada@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Masahiko Sawada @ 2026-10-01 13:20 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Refresh autovacuum costs while waiting for parallel workers.

Commit 1ff3180ca01 made a parallel autovacuum leader propagate changes
to the cost-based delay parameters to its workers only from
vacuum_delay_point(), which it no longer reaches once it is waiting in
WaitForParallelWorkersToFinish(). While waiting, the leader neither
processed a config reload nor noticed a change in the number of
autovacuum workers sharing the cost limit, so its workers kept running
with stale parameters until they finished.

Fix by refreshing and propagating the parameters on every wakeup of
that wait loop, and by setting the latches of the balanced autovacuum
workers when their count changes so that a waiting leader wakes up.

A regression test will be added in a separate commit.

Backpatch to v19, where parallel autovacuum was introduced.

Reported-by: Nikolay Samokhvalov <nik@postgres.ai>
Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Manu <manuelreyesbravo@gmail.com>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAM527d-GL=Jp2EJXBSnVBGPK-4XEZwWof5Cv8P0hghS_og6oAg@mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/42e96cf2fe095c822f76bc94669ea875cb1e3351

Modified Files
--------------
src/backend/access/transam/parallel.c | 11 +++++++++++
src/backend/commands/vacuumparallel.c | 35 +++++++++++++++++++++++++++++++++++
src/backend/postmaster/autovacuum.c   | 25 +++++++++++++++++++++++++
src/include/commands/vacuum.h         |  1 +
4 files changed, 72 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Refresh autovacuum costs while waiting for parallel workers.
@ 2026-10-01 13:20  Masahiko Sawada <msawada@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Masahiko Sawada @ 2026-10-01 13:20 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Refresh autovacuum costs while waiting for parallel workers.

Commit 1ff3180ca01 made a parallel autovacuum leader propagate changes
to the cost-based delay parameters to its workers only from
vacuum_delay_point(), which it no longer reaches once it is waiting in
WaitForParallelWorkersToFinish(). While waiting, the leader neither
processed a config reload nor noticed a change in the number of
autovacuum workers sharing the cost limit, so its workers kept running
with stale parameters until they finished.

Fix by refreshing and propagating the parameters on every wakeup of
that wait loop, and by setting the latches of the balanced autovacuum
workers when their count changes so that a waiting leader wakes up.

A regression test will be added in a separate commit.

Backpatch to v19, where parallel autovacuum was introduced.

Reported-by: Nikolay Samokhvalov <nik@postgres.ai>
Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Manu <manuelreyesbravo@gmail.com>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAM527d-GL=Jp2EJXBSnVBGPK-4XEZwWof5Cv8P0hghS_og6oAg@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4a80214270a76316d2967ed1275b969914fa0267

Modified Files
--------------
src/backend/access/transam/parallel.c | 11 +++++++++++
src/backend/commands/vacuumparallel.c | 35 +++++++++++++++++++++++++++++++++++
src/backend/postmaster/autovacuum.c   | 25 +++++++++++++++++++++++++
src/include/commands/vacuum.h         |  1 +
4 files changed, 72 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-10-01 13:20 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01 13:20 pgsql: Refresh autovacuum costs while waiting for parallel workers. Masahiko Sawada <msawada@postgresql.org>
2026-10-01 13:20 pgsql: Refresh autovacuum costs while waiting for parallel workers. Masahiko Sawada <msawada@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox