Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE
Date
Msg-id CAFj8pRB_FH-Pcth9XFcpY2OTasVOP-2DfYOsVxL38igw0O4hdg@mail.gmail.com
Whole thread Raw
In response to Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Hi

ne 14. 12. 2025 v 8:26 odesílatel Michael Paquier <michael@paquier.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




pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: Add WALRCV_CONNECTING state to walreceiver
Next
From: Xuneng Zhou
Date:
Subject: Re: Add WALRCV_CONNECTING state to walreceiver