RE: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE - Mailing list pgsql-hackers

From Aya Iwata (Fujitsu)
Subject RE: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE
Date
Msg-id OS3PR01MB8889505E2F3E443CCA4BD72EEA45A@OS3PR01MB8889.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE  (Michael Paquier <michael@paquier.xyz>)
Responses Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE
List pgsql-hackers
Hi

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

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.

Log of Build Farm;
2026-03-10 21:08:33.103 CET [28076:4] 002_worker_terminate.pl LOG:  statement: ALTER DATABASE testdb RENAME TO
renameddb
2026-03-10 21:08:34.578 CET [28071:2] FATAL:  terminating background worker "worker_spi dynamic" due to administrator
command
2026-03-10 21:08:38.109 CET [28076:5] 002_worker_terminate.pl ERROR:  database "testdb" is being accessed by other
users
2026-03-10 21:08:38.109 CET [28076:6] 002_worker_terminate.pl DETAIL:  There is 1 other session using the database.
2026-03-10 21:08:38.109 CET [28076:7] 002_worker_terminate.pl STATEMENT:  ALTER DATABASE testdb RENAME TO renameddb
2026-03-10 21:08:38.229 CET [28076:8] 002_worker_terminate.pl LOG:  disconnection: session time: 0:00:05.129
user=buildfarmdatabase=postgres host=[local] 
2026-03-10 21:08:38.231 CET [28025:6] LOG:  background worker "worker_spi dynamic" (PID 28071) exited with exit code 1
2026-03-10 21:08:38.234 CET [28025:7] LOG:  received immediate shutdown request
2026-03-10 21:08:38.241 CET [28025:8] LOG:  database system is shut down

If there is a lock conflict, we will come up with a solution.

Regards,
Aya Iwata



pgsql-hackers by date:

Previous
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: [PATCH] Support automatic sequence replication
Next
From: Heikki Linnakangas
Date:
Subject: Re: Better shared data structure management and resizable shared data structures