Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: "Aya Iwata (Fujitsu)" <iwata(dot)aya(at)fujitsu(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE
Date: 2025-12-14 07:40:20
Message-ID: CAFj8pRB_FH-Pcth9XFcpY2OTasVOP-2DfYOsVxL38igw0O4hdg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

ne 14. 12. 2025 v 8:26 odesílatel Michael Paquier <michael(at)paquier(dot)xyz>
napsal:

> On Wed, Oct 15, 2025 at 02:48:43AM +0000, Aya Iwata (Fujitsu) wrote:
> > Thank you for your comments. I updated this patch to v0007.
>
> + * Exit the bgworker when its database is dropped, renamed, moved to a
> + * different tablespace, or used as a template for CREATE DATABASE.
>
> I don't think that we need to list all these operations in details
> here. We could just say "if its database is involved in a CREATE,
> ALTER or DROP database command". The docs should provide these
> details, of course.
>
> +#define BGWORKER_EXIT_AT_DATABASE_CHANGE 0x0004
>
>
I am checking this patch, and I think so used names can be little bit
confusing

BGWORKER_EXIT_AT_DATABASE_CHANGE - it is used for disconnecting workers on
the template database, and this database is not changing.

TerminateBgWorkersByDbOid - it doesn't terminate all workers, but only
workers with some special flags

Maybe BGWORKER_INTERRUPTABLE and TerminateInterruptableBgWorkersByDbOid ?

Another question is if this cancellation should be implicit and should not
require some special flag.

When I want to disconnect connections to database when I do drop, I have to
use FORCE flag

So maybe there should be ALTER DATABASE ... RENAME ... FORCE - or if FORCE
can terminare all workers (without special FLAG) ?

Regards

Pavel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Xuneng Zhou 2025-12-14 08:55:28 Re: Add WALRCV_CONNECTING state to walreceiver
Previous Message Noah Misch 2025-12-14 05:14:22 Re: Add WALRCV_CONNECTING state to walreceiver