On Mon, Nov 9, 2026 at 4:46 PM Zsolt Parragi <[email protected]> wrote:
>
> > 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.
>
> Thanks, this is basically the same thing I had in mind.
>
> I attached a v3 based with a few changes:
>
> * The docs still said "the postmaster sends a termination signal",
> which is no longer true.
> * Added Xuneng's doc comment in the test
> * I also removed the pid <> $pid condition based on Xuneng's comment
> * I changed the max_worker_processes back to total_slots, since that
> seem to be more generally used in these functions
> * There was a typo in the commit message ("restarted or nor")

There seems to be a risk of interpreting the exit of worker & its PID
reuse as non-exit failure here. How about adding a new critera like
process start time for checking that as V4 does.

# Run query and verify that the bgworker with the specified PID has been
# terminated.
sub run_bgworker_interruptible_test
{
my ($node, $command, $testname, $pid) = @_;
my $offset = -s $node->logfile;

...

my $result = $node->safe_psql('postgres',
"SELECT count(*) = 0 FROM pg_stat_activity WHERE pid = $pid;");
is($result, 't', "dynamic bgworker stopped for $testname");
}

--
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.

Attachment: v4-0001-Fix-restart-of-interruptible-bgworkers-after-database-commands.patch
Description: Binary data

Reply via email to