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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "Aya Iwata (Fujitsu)" <iwata(dot)aya(at)fujitsu(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, 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-03-16 07:23:40
Message-ID: abev_E-SE94zHP0n@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 13, 2026 at 11:38:51AM +0000, Aya Iwata (Fujitsu) wrote:
> On March 10th, the bgworker test "t/002_worker_terminate.pl" failed on the Build Farm.
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jay&dt=2026-03-10%2019%3A26%3A19

Indeed.

> We are currently attempting to reproduce this issue and are considering a fix.
>
> According to the log, the test failed because the bgworker cannot be terminated
> within the time frame (5 seconds) when ALTER DATABASE RENAME is executed.
>
> So I suspect that there is a lock conflict.

Aye, we have a timing issue here, and at first it seemed to me that
this was a bug in the backend logic. But actually I suspect that it
is simpler than that: we don't disable autovacuum so couldn't an
autovacuum worker connect to the database "testdb" that we are trying
to rename in this query? I cannot be 100% sure because we have
reduced the log activity for the sake of the tests, but that feels
possible to me. We could try to disable autovacuum entirely, then see
if the situation gets better in the buildfarm.

The failure rate is so low that it is likely going to take a few weeks
to check the stability of the situation. We could also lot more
things, of course, as a temporary solution.

What do you think?
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-03-16 07:32:53 Re: Improve OAuth discovery logging
Previous Message Andrey Borodin 2026-03-16 07:10:16 Re: Improve OAuth discovery logging