| 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:31:13 |
| Message-ID: | E1xTtnk-00000000Kun-08dc@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
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/1901aa07eda15591423fe63e414c07dad2f23ec5
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:22 | pgsql: Avoid delaying WAL receiver shutdown while draining WAL |
| Previous Message | Fujii Masao | 2026-11-19 04:31:02 | pgsql: Avoid delaying WAL receiver shutdown while draining WAL |