Re: BGWORKER_INTERRUPTIBLE workers are never restarted after DROP/ALTER/CREATE DATABASE

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: BGWORKER_INTERRUPTIBLE workers are never restarted after DROP/ALTER/CREATE DATABASE
Date: 2026-11-09 03:45:46
Message-ID: avFB6lUa9H8r-lwu@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 09, 2026 at 10:39:37AM +0800, Xuneng Zhou wrote:
> That's what I've in mind. My original thought is to add worker
> selection and terminatiion into the existing CountOtherDBBackends
> scan. That avoids the separate worker-slot scan and PID lookups in
> ForDatabase(), at the cost of adding and initializing a new marker in
> PGPROC like PROC_IS_BGWORKER_INTERRUPTIBLE. Is this sensible/doable?

Hmm, no. I had something less complicated in mind, as of the
patch attached.

Note also that I have changed the SQL function to use a integer for
the restart time, defaulting to -1 to map with the never-restart.
Passing down a restart time of 0 also makes the test faster, as the
worker is restarted without a delay.

So the attached patch removes the need for a flag, and just relies on
a plain kill(). Once we do that, the restart time gets effective when
set.
--
Michael

Attachment Content-Type Size
v2-0001-Fix-restart-of-interruptible-bgworkers-after-data.patch text/plain 7.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan S. Katz 2026-11-09 03:58:55 2026-11-12 release announcement draft
Previous Message Michael Paquier 2026-11-09 03:42:52 Re: BGWORKER_INTERRUPTIBLE workers are never restarted after DROP/ALTER/CREATE DATABASE