[PG19] pg_signal_autovacuum_worker can't signal parallel autovacuum workers

From: Adesh Thakare <adeshthakare10(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, nathandbossart(at)gmail(dot)com, 3danissimo(at)gmail(dot)com, reshkekirill(at)gmail(dot)com
Subject: [PG19] pg_signal_autovacuum_worker can't signal parallel autovacuum workers
Date: 2026-12-03 23:40:34
Message-ID: CAFoBUgLv5gxtp7Svt-9fAzdUTb=gHftEkVSP7D4jeSnhOfok3w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

In v19, a role with privileges of pg_signal_autovacuum_worker can cancel
or terminate an autovacuum worker, but not the parallel workers it
launches for parallel autovacuum; it gets the superuser error instead.
The autovacuum worker advertises no role, while its parallel workers
advertise the bootstrap superuser, so they are treated as superuser
backends. This has the same cause as the DROP DATABASE ... FORCE failure
fixed in a39e53a700c [1], but that commit fixed only that path. One place
it shows up is the common query that terminates all other sessions in a
database: run by such a role, it now fails with the superuser error when
it reaches a parallel worker's row.

The attached 0001 checks a parallel worker as its leader when the leader
advertises no role, the same rule a39e53a700c uses. Signaling a parallel
worker has the same effect as cancelling its autovacuum worker: the
autovacuum worker logs an error for the current table and moves on to
the next one. So this doesn't let anyone do more than they already can
through the leader. Parallel workers of a background worker connected
without a user name stay superuser-only, and those of other leaders are
unchanged. 0002 adds a TAP test using the existing parallel vacuum
injection point. The fix needs to be backpatched to v19.

[1]
https://postgr.es/m/CALj2ACWK6PkOk5MTfibtJyTYpb=Aq_8=YaexnPKhOj11bOCROQ@mail.gmail.com

Thanks,
Adesh Thakare

Attachment Content-Type Size
v1-0001-Let-pg_signal_autovacuum_worker-signal-parallel-a.patch application/octet-stream 5.1 KB
v1-0002-Add-a-test-for-signaling-parallel-autovacuum-work.patch application/octet-stream 8.7 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-12-03 23:45:17 Re: [PATCH] pageinspect: validate line pointers before using them
Previous Message Fujii Masao 2026-12-03 23:37:27 Re: Why is the LSN reported for pg_logical_emit_message() different from other decoded operations?