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

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: "Aya Iwata (Fujitsu)" <iwata(dot)aya(at)fujitsu(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Pavel Stehule <pavel(dot)stehule(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: 2026-01-05 21:18:39
Message-ID: CAHut+PtZh+B_-z_TzmToUhL4-sBrf7dfH0uAb7VU-jkXFmHQSA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 6, 2026 at 2:06 AM Aya Iwata (Fujitsu)
<iwata(dot)aya(at)fujitsu(dot)com> wrote:
>
> Hi
>
> Thank you for your comments and suggestions on the previous version patches!
> I believe this feature become much better.
>
> I've created a v13 patch incorporating Peter-san's suggestions.
>

Some review comments for v13-0001.

======
src/backend/storage/ipc/procarray.c

CountOtherDBBackends:

1.
* If there are other backends in the DB, we will wait a maximum of 5 seconds
- * for them to exit. Autovacuum backends are encouraged to exit early by
- * sending them SIGTERM, but normal user backends are just waited for.
+ * for them to exit. Autovacuum backends and background workers are encouraged
+ * to exit early by sending them PMSIGNAL_BACKGROUND_WORKER_CHANGE, but normal
+ * user backends are just waited for.

This did not seem like the correct fix for my previous review comment
[1, comment #3], because the autovacuum backends are still killed with
SIGTERM, right?

======
.../worker_spi/t/002_worker_terminate.pl

2.
+# Confirm that the non-interruptible bgworker is still running.
+my $result = $node->safe_psql(
+ "postgres", qq(
+ SELECT count(1) FROM pg_stat_activity
+ WHERE backend_type = 'worker_spi dynamic';));

The indentation of the "SELECT" still does not look correct to me. Did
you run pgperltidy on this file?

======
[1] https://www.postgresql.org/message-id/CAHut%2BPtSVYKU4vfaRev4FMdbeZ3ukvxRy4X7uK05jv_9WMYafA%40mail.gmail.com

Kind Regards,
Peter Smith.
Fujitsu Australia

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2026-01-05 21:35:45 Re: failed NUMA pages inquiry status: Operation not permitted
Previous Message Daniil Davydov 2026-01-05 20:44:02 Re: POC: Parallel processing of indexes in autovacuum