Re: [PG19] pg_signal_autovacuum_worker can't signal parallel autovacuum workers

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Adesh Thakare <adeshthakare10(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, 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: Re: [PG19] pg_signal_autovacuum_worker can't signal parallel autovacuum workers
Date: 2026-12-04 00:29:37
Message-ID: CAD21AoB_QkXwDw8o4uvjPcy3-sB=LCBhOu_Fer03+NA84TYMnA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 3, 2026 at 3:40 PM Adesh Thakare <adeshthakare10(at)gmail(dot)com> wrote:
>
> 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.

We discussed this point in that thread[1]. Bharath asked whether
pg_signal_autovacuum_worker should also cover the parallel workers
launched by autovacuum workers, and I answered that it would be a
separate topic for v20. Parallel workers are bgworkers, not autovacuum
workers, so the current behavior doesn't contradict the docs, and
users can stop them by terminating the autovacuum worker. So I don't
think it's something a39e53a700c missed.

> 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.

But I hadn't considered this case. IIUC a role with both
pg_signal_backend and pg_signal_autovacuum_worker could run such a
query on v18, and on v19 it fails if a parallel autovacuum happens to
be running in the database. Although such a query already fails if the
database has a superuser session or a bgworker connected without a
user name, I don't think it's good that v19 breaks existing queries
like this. So I think I need to change my mind; it seems better to fix
it in v19 rather than waiting for v20.

I'll review the patches.

Regards,

[1] https://postgr.es/m/CAD21AoDbRMS8QMPKnZiu+0hKNSW_x52jdRho=VbUP4=_=4U=-g@mail.gmail.com

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Xueyu Gao 2026-12-04 00:34:09 Re:Re: add --transfer-mode to pg_upgrade
Previous Message Ideriha, Takeshi 2026-12-04 00:23:00 Re: Unused code in brin_minmax_multi_consistent