postgresql/src/include
Fujii Masao db93032a7c 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
2026-04-08 11:22:21 +09:00
..
access Add EXPLAIN (IO) infrastructure with BitmapHeapScan support 2026-04-07 22:33:34 +02:00
archive Update copyright for 2026 2026-01-01 13:24:10 -05:00
backup Update copyright for 2026 2026-01-01 13:24:10 -05:00
bootstrap Reduce header inclusions via execnodes.h 2026-03-16 14:34:57 +01:00
catalog Add pg_stat_autovacuum_scores system view. 2026-04-06 16:56:33 -05:00
commands Add EXPLAIN (IO) infrastructure with BitmapHeapScan support 2026-04-07 22:33:34 +02:00
common Remove bits* typedefs. 2026-03-30 16:12:08 -05:00
datatype Update copyright for 2026 2026-01-01 13:24:10 -05:00
executor instrumentation: Move ExecProcNodeInstr to allow inlining 2026-04-07 21:36:49 -04:00
fe_utils Harden astreamer tar parsing logic against archives it can't handle. 2026-04-02 12:20:36 -04:00
foreign Remove bits* typedefs. 2026-03-30 16:12:08 -05:00
jit jit: No backport::SectionMemoryManager for LLVM 22. 2026-04-03 14:55:11 +13:00
lib Use standard C23 and C++ attributes if available 2026-04-01 08:15:02 +02:00
libpq oauth: Allow validators to register custom HBA options 2026-04-07 08:15:19 -07:00
mb Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:44:04 +13:00
nodes Add EXPLAIN (IO) instrumentation for TidRangeScan 2026-04-07 23:25:05 +02:00
optimizer Add UPDATE/DELETE FOR PORTION OF 2026-04-01 19:06:03 +02:00
parser Mark JumbleState as a const in the post_parse_analyze hook 2026-04-07 15:22:49 +09:00
partitioning Update copyright for 2026 2026-01-01 13:24:10 -05:00
pch Update copyright for 2026 2026-01-01 13:24:10 -05:00
port Allow retrieving x86 TSC frequency/flags from CPUID 2026-04-07 13:00:24 -04:00
portability pg_test_timing: Also test RDTSC[P] timing, report time source, TSC frequency 2026-04-07 17:12:08 -04:00
postmaster Convert all remaining subsystems to use the new shmem allocation API 2026-04-06 02:13:10 +03:00
regex Update copyright for 2026 2026-01-01 13:24:10 -05:00
replication Fix slotsync worker blocking promotion when stuck in wait 2026-04-08 11:22:21 +09:00
rewrite Add some const qualifiers enabled by typeof_unqual change on copyObject 2026-03-19 06:35:54 +01:00
snowball Update to latest Snowball sources. 2026-01-05 15:22:37 -05:00
statistics Add support for "mcv" in pg_restore_extended_stats() 2026-01-29 12:14:08 +09:00
storage Fix slotsync worker blocking promotion when stuck in wait 2026-04-08 11:22:21 +09:00
tcop SQL Property Graph Queries (SQL/PGQ) 2026-03-16 10:14:18 +01:00
tsearch Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:44:04 +13:00
utils instrumentation: Use Time-Stamp Counter on x86-64 to lower overhead 2026-04-07 13:00:24 -04:00
.gitignore Use <stdint.h> and <inttypes.h> for c.h integers. 2024-12-04 15:05:38 +13:00
c.h Use standard C23 and C++ attributes if available 2026-04-01 08:15:02 +02:00
fmgr.h Improve type handling of varlena structures 2026-02-11 07:33:24 +09:00
funcapi.h Remove bits* typedefs. 2026-03-30 16:12:08 -05:00
getopt_long.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
Makefile Fix build inconsistency due to the generation of wait-event code 2026-02-02 08:02:39 +09:00
meson.build Ensure that all three build methods install the same set of files. 2026-02-16 15:20:15 -05:00
miscadmin.h Add errdetail() with PID and UID about source of termination signal. 2026-04-07 10:22:33 -04:00
pg_config.h.in Add errdetail() with PID and UID about source of termination signal. 2026-04-07 10:22:33 -04:00
pg_config_manual.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pg_getopt.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pg_trace.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pgstat.h Convert all remaining subsystems to use the new shmem allocation API 2026-04-06 02:13:10 +03:00
pgtar.h Harden astreamer tar parsing logic against archives it can't handle. 2026-04-02 12:20:36 -04:00
pgtime.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
port.h strnlen() is now required 2026-01-08 08:51:20 +01:00
postgres.h Remove Int8GetDatum function 2026-03-11 10:46:08 +01:00
postgres_ext.h Move pg_int64 back to postgres_ext.h 2025-09-16 10:48:56 +02:00
postgres_fe.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
varatt.h Improve type handling of varlena structures 2026-02-11 07:33:24 +09:00
windowapi.h Update copyright for 2026 2026-01-01 13:24:10 -05:00