| From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
|---|---|
| To: | "Aya Iwata (Fujitsu)" <iwata(dot)aya(at)fujitsu(dot)com> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, 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-15 13:18:19 |
| Message-ID: | CAFj8pRCRnN4SyZDPbQwTyKZ_kVHfwLG6udCXsXDTG_z9fWwYQg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
po 15. 12. 2025 v 13:56 odesílatel Aya Iwata (Fujitsu) <
iwata(dot)aya(at)fujitsu(dot)com> napsal:
> Hi
>
> Thank you for your review.
>
> > From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> > Sent: Sunday, December 14, 2025 4:40 PM
> > To: Michael Paquier <michael(at)paquier(dot)xyz>
> > Cc: Iwata, Aya/岩田 彩 <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>; Kuroda,
> Hayato/黒田 隼人 <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
> >
> > +#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 ?
>
> Thank you for your advice.
> I changed the name of a function and a flag.
>
> > 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) ?
>
> For the proposed feature, we've added a flag allowing each extension
> developer to decide whether to terminate it via DROP/ALTER DATABASE.
> Adding a FORCE option to ALTER to let database definition modifiers decide
> whether to force termination of background workers might be better
> discussed in a separate thread.
>
When I thought about it - there can be a second alternative.
Introduce a pair of flags BGWORKER_INTERRUPTABLE and BGWORKER_PROTECTED
(the names can be enhanced or changed). BGWORKER_INTERRUPTABLE can be
default.
ALTER DATABASE RENAME and related commands can stop any non protected
workers. ALTER DATABASE RENAME FORCE can stop any workers (including
protected).
Is there any reason why BGWORKER_INTERRUPTABLE cannot be default? Probably
nobody would block some possibly common operations on database level
without strong reason.
Regards
Pavel
> Best Regards,
> Aya Iwata
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Euler Taveira | 2025-12-15 13:38:08 | Re: Add support for specifying tables in pg_createsubscriber. |
| Previous Message | Ashutosh Bapat | 2025-12-15 13:13:08 | Re: SQL Property Graph Queries (SQL/PGQ) |