]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Wake up autovacuum launcher from postmaster when a worker exits
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 15 Jan 2026 16:02:25 +0000 (18:02 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 15 Jan 2026 16:02:25 +0000 (18:02 +0200)
commitd9c3c943653740d1df44385c3cd658ed67bb4fb2
tree228f2df7635bf62f3d07758d415ff768844684d0
parent102bdaa9be13e65de898991f69ddeea517789fb3
Wake up autovacuum launcher from postmaster when a worker exits

When an autovacuum worker exits, the launcher needs to be notified
with SIGUSR2, so that it can rebalance and possibly launch a new
worker. The launcher must be notified only after the worker has
finished ProcKill(), so that the worker slot is available for a new
worker. Before this commit, the autovacuum worker was responsible for
that, which required a slightly complicated dance to pass the
launcher's PID from FreeWorkerInfo() to ProcKill() in a global
variable.

Simplify that by moving the responsibility of the signaling to the
postmaster. The postmaster was already doing it when it failed to fork
a worker process, so it seems logical to make it responsible for
notifying the launcher on worker exit too. That's also how the
notification on background worker exit is done.

Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: li carol <carol.li2025@outlook.com>
Discussion: https://www.postgresql.org/message-id/a5e27d25-c7e7-45d5-9bac-a17c8f462def@iki.fi
src/backend/postmaster/autovacuum.c
src/backend/postmaster/postmaster.c
src/backend/storage/lmgr/proc.c
src/include/postmaster/autovacuum.h