| From: | Fujii Masao <fujii(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Avoid delaying WAL receiver shutdown while draining WAL |
| Date: | 2026-11-19 04:30:47 |
| Message-ID: | E1xTtnK-00000000Ksh-0hFe@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Avoid delaying WAL receiver shutdown while draining WAL
Standby shutdown, promotion, and changes to replication connection
settings could be delayed while the WAL receiver was continuously
receiving WAL.
The inner receive loop in WalReceiverMain() processed all immediately
available messages without checking interrupts. If WAL arrived faster
than the receiver could write it, the receiver could remain in this
loop with SIGTERM pending, leaving the startup process waiting for it
to exit.
Fix this by checking interrupts on each iteration of the inner loop so
that pending shutdown requests are handled even when more WAL is
available.
Backpatch to all supported versions.
Reported-by: Andres Freund <andres(at)anarazel(dot)de>
Author: Nitin Jadhav <nitinjadhavpostgres(at)gmail(dot)com>
Reviewed-by: Joao Rito <joaovictor(dot)rito(at)gmail(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/20210511022755.wcb5h4czadxsgewt@alap3.anarazel.de
Discussion: https://postgr.es/m/CAMm1aWY-bps8VPCdyTTZo6NZicSRrq0kBArzjKTZoKHdN_wqOA@mail.gmail.com
Backpatch-through: 15
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5c06a7ef24c70226db22310b4c6bad546b6f3335
Modified Files
--------------
src/backend/replication/walreceiver.c | 2 ++
1 file changed, 2 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-11-19 04:31:02 | pgsql: Avoid delaying WAL receiver shutdown while draining WAL |
| Previous Message | Jeff Davis | 2026-11-19 04:04:53 | pgsql: Fix CREATE DATABASE when template0 has ICU rules. |