]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix slotsync worker blocking promotion when stuck in wait
authorFujii Masao <fujii@postgresql.org>
Wed, 8 Apr 2026 02:23:13 +0000 (11:23 +0900)
committerFujii Masao <fujii@postgresql.org>
Wed, 8 Apr 2026 02:23:13 +0000 (11:23 +0900)
commit58c1188a3eaa5681bb4de769c3f8cd84c15b8825
tree84154329db6c986807ddd9ccb0c6bc3993fba6d9
parent94efd308bcec9ecb45c2f1977c3c15bec383316e
Fix slotsync worker blocking promotion when stuck in wait

Previously, on standby promotion, the startup process sent SIGUSR1 to
the slotsync worker (or a backend performing slot synchronization) and
waited for it to exit. This worked in most cases, but if the process was
blocked waiting for a response from the primary (e.g., due to a network
failure), SIGUSR1 would not interrupt the wait. As a result, the process
could remain stuck, causing the startup process to wait for a long time
and delaying promotion.

This commit fixes the issue by introducing a new procsignal reason,
PROCSIG_SLOTSYNC_MESSAGE. On promotion, the startup process
sends this signal, and the handler sets interrupt flags so the process
exits (or errors out) promptly at CHECK_FOR_INTERRUPTS(), allowing
promotion to complete without delay.

Backpatch to v17, where slotsync was introduced.

Author: Nisha Moond <nisha.moond412@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwFzNYroAxSoyJhqTU-pH=t4Ej6RyvhVmBZ91Exj_TPMMQ@mail.gmail.com
Backpatch-through: 17
src/backend/replication/logical/slotsync.c
src/backend/storage/ipc/procsignal.c
src/backend/tcop/postgres.c
src/include/replication/slotsync.h
src/include/storage/procsignal.h