Hi,

On Tue, Oct 13, 2026 at 4:17 PM Masahiko Sawada <[email protected]> wrote:
>
> > > Fine with me. But probably can we remove leader->databaseId ==
> > > databaseId check? It seems redundant for parallel workers.
>
> > That's correct, but I would like to be more cautious here, so I
> > retained it. I also added a check that the parallel worker's
> > advertised role is the bootstrap superuser, again to be more cautious.
>
> Hmm,  I don't think these checks narrow the case. When the leader
> advertises no role, it goes through
> InitializeSessionUserIdStandalone(), so its parallel workers always
> run as the bootstrap superuser and connect to the same database. So
> both checks are always true once !OidIsValid(leader->roleId) holds.
> Even if a worker advertised another role, I think judging it by its
> leader would still be fine, since we accept terminating the leader and
> the worker exits with it anyway. So I'd prefer to remove both checks,
> as they make readers think when they could be false.

Agreed, let me not be over-cautious. We likely don't, and never will,
change InitializeSessionUserIdStandalone() for such bg/parallel
workers. I will remove both the database OID and bootstrap superuser
checks in the next version.

> Also, regarding the following documentation change:
>
> -      This terminates background worker connections and connections that the
> -      current user has permission to terminate
> +      This terminates background worker connections, the parallel workers 
> they
> +      launch, and connections that the current user has permission to 
> terminate
>
> I think we don't need this change as parallel workers are background
> workers, no?

I would like to keep it for clarity, especially since not every
parallel worker is exempted here, only the ones started by autovacuum
workers or bg workers.

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com


Reply via email to