postgresql/src/include/replication
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
..
decode.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
logical.h Ensure that the sync slots reach a consistent state after promotion without losing data. 2024-04-03 14:04:59 +05:30
logicallauncher.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
logicalproto.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
logicalrelation.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
logicalworker.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
message.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
origin.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
output_plugin.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgoutput.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
reorderbuffer.h Replace binaryheap + index with pairingheap in reorderbuffer.c 2024-04-11 17:04:38 +09:00
slot.h Post-commit review fixes for slot synchronization. 2024-04-25 14:01:44 +05:30
slotsync.h Remove unused function prototype 2024-04-19 09:58:04 +02:00
snapbuild.h Ensure that the sync slots reach a consistent state after promotion without losing data. 2024-04-03 14:04:59 +05:30
syncrep.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
walreceiver.h Refactor postmaster child process launching 2024-03-18 11:35:30 +02:00
walsender.h Introduce a new GUC 'standby_slot_names'. 2024-03-08 08:10:45 +05:30
walsender_private.h Introduce a new GUC 'standby_slot_names'. 2024-03-08 08:10:45 +05:30
worker_internal.h Update copyright for 2024 2024-01-03 20:49:05 -05:00