postgresql/src/include
Amit Kapila db08e8c6fa Post-commit review fixes for slot synchronization.
Allow pg_sync_replication_slots() to error out during promotion of standby.
This makes the behavior of the SQL function consistent with the slot sync
worker. We also ensured that pg_sync_replication_slots() cannot be
executed if sync_replication_slots is enabled and the slotsync worker is
already running to perform the synchronization of slots. Previously, it
would have succeeded in cases when the worker is idle and failed when it
is performing sync which could confuse users.

This patch fixes another issue in the slot sync worker where
SignalHandlerForShutdownRequest() needs to be registered *before* setting
SlotSyncCtx->pid, otherwise, the slotsync worker could miss handling
SIGINT sent by the startup process(ShutDownSlotSync) if it is sent before
worker could register SignalHandlerForShutdownRequest(). To be consistent,
all signal handlers' registration is moved to a prior location before we
set the worker's pid.

Ensure that we clean up synced temp slots at the end of
pg_sync_replication_slots() to avoid such slots being left over after
promotion.

Ensure that ShutDownSlotSync() captures SlotSyncCtx->pid under spinlock to
avoid accessing invalid value as it can be reset by concurrent slot sync
exit due to an error.

Author: Shveta Malik
Reviewed-by: Hou Zhijie, Bertrand Drouvot, Amit Kapila, Masahiko Sawada
Discussion: https://postgr.es/m/CAJpy0uBefXUS_TSz=oxmYKHdg-fhxUT0qfjASW3nmqnzVC3p6A@mail.gmail.com
2024-04-25 14:01:44 +05:30
..
access Add missing index_insert_cleanup calls 2024-04-19 16:08:34 +02:00
archive Add macro for customizing an archiving WARNING message. 2024-03-04 15:41:42 -06:00
backup Align blocks in incremental backups to BLCKSZ 2024-04-05 16:30:01 +02:00
bootstrap Update copyright for 2024 2024-01-03 20:49:05 -05:00
catalog Fix restore of not-null constraints with inheritance 2024-04-18 15:35:15 +02:00
commands revert: Generalize relation analyze in table AM interface 2024-04-16 13:14:20 +03:00
common Fix typos and duplicate words 2024-04-18 21:28:07 +02:00
datatype Update copyright for 2024 2024-01-03 20:49:05 -05:00
executor Add TupleTableSlotOps.is_current_xact_tuple() method 2024-03-21 23:00:43 +02:00
fe_utils Allow dbname to be written as part of connstring via pg_basebackup's -R option. 2024-03-21 10:50:33 +05:30
foreign Clean up more indent breakage from 6377e12a5. 2024-04-16 13:00:40 -04:00
jit jit: Require at least LLVM 10. 2024-01-25 15:42:34 +13:00
lib Fix typos and duplicate words 2024-04-18 21:28:07 +02:00
libpq Send ALPN in TLS handshake, require it in direct SSL connections 2024-04-08 04:24:51 +03:00
mb Inline basic UTF-8 functions. 2024-03-20 09:40:57 -07:00
nodes Improve comment of DeallocateStmt->isall 2024-04-25 10:20:49 +09:00
optimizer revert: Transform OR clauses to ANY expression 2024-04-10 02:28:09 +03:00
parser JSON_TABLE: Add support for NESTED paths and columns 2024-04-08 16:14:13 +09:00
partitioning Implement ALTER TABLE ... SPLIT PARTITION ... command 2024-04-07 01:18:44 +03:00
pch Update copyright for 2024 2024-01-03 20:49:05 -05:00
port Add XLogCtl->logInsertResult 2024-04-07 14:06:30 +02:00
portability Update copyright for 2024 2024-01-03 20:49:05 -05:00
postmaster Add missing PGDLLIMPORT markings 2024-04-16 09:38:46 +09:00
regex Update copyright for 2024 2024-01-03 20:49:05 -05:00
replication Post-commit review fixes for slot synchronization. 2024-04-25 14:01:44 +05:30
rewrite Support MERGE into updatable views. 2024-02-29 15:56:59 +00:00
snowball Update copyright for 2024 2024-01-03 20:49:05 -05:00
statistics Update copyright for 2024 2024-01-03 20:49:05 -05:00
storage Fix typos and duplicate words 2024-04-18 21:28:07 +02:00
tcop Invent SERIALIZE option for EXPLAIN. 2024-04-03 17:41:57 -04:00
tsearch Update copyright for 2024 2024-01-03 20:49:05 -05:00
utils Remove resowner_private.h 2024-04-20 18:01:03 +09:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
Makefile Put genbki.pl output into src/include/catalog/ directly 2024-03-14 07:11:21 +01:00
c.h Add macro to disable address safety instrumentation 2024-04-06 12:20:40 +07:00
fmgr.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
funcapi.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
getopt_long.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
miscadmin.h Remove assertions that some compiler say are tautological 2024-03-20 09:14:51 +02:00
pg_config.h.in Optimize pg_popcount() with AVX-512 instructions. 2024-04-06 21:56:23 -05:00
pg_config_ext.h.in
pg_config_ext.h.meson meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pg_config_manual.h Introduce a non-recursive JSON parser 2024-04-04 06:46:40 -04:00
pg_getopt.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_trace.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgstat.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgtar.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgtime.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
port.h Replace calls to pg_qsort() with the qsort() macro. 2024-02-16 11:37:50 -06:00
postgres.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
postgres_ext.h Move RelFileNumber declarations to common/relpath.h. 2022-09-27 12:01:57 -04:00
postgres_fe.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
varatt.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
windowapi.h Update copyright for 2024 2024-01-03 20:49:05 -05:00