diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml index 33940504622..cae8a376c3b 100644 --- a/doc/src/sgml/logicaldecoding.sgml +++ b/doc/src/sgml/logicaldecoding.sgml @@ -406,13 +406,12 @@ postgres=# SELECT * from pg_logical_slot_get_changes('regression_slot', NULL, NU synchronized using the pg_sync_replication_slots function on the standby. However, unlike automatic synchronization, it does not perform incremental - updates. It retries cyclically to some extent—continuing until all - the failover slots that existed on primary at the start of the function - call are synchronized. Any slots created after the function begins will - not be synchronized. In contrast, automatic synchronization - via sync_replication_slots provides continuous slot - updates, enabling seamless failover and supporting high availability. - Therefore, it is the recommended method for synchronizing slots. + updates. It retries cyclically until all the failover slots that existed on + primary at the start of the function call are synchronized. Any slots created + after the function begins will not be synchronized. In contrast, automatic + synchronization via sync_replication_slots provides + continuous slot updates, enabling seamless failover and supporting high + availability. Therefore, it is the recommended method for synchronizing slots. diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c index 437e882fa81..10a769ccf85 100644 --- a/src/backend/replication/logical/slotsync.c +++ b/src/backend/replication/logical/slotsync.c @@ -608,7 +608,7 @@ reserve_wal_for_local_slot(XLogRecPtr restart_lsn) * future synchronization; otherwise, do nothing. * * *slot_persistence_pending is set to true if any of the slots fail to - * persist. It is utilized by the SQL function pg_sync_replication_slots(). + * persist. * * Return true if the slot is marked as RS_PERSISTENT (sync-ready), otherwise * false. @@ -688,7 +688,7 @@ update_and_persist_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid, * periodic syncs. * * *slot_persistence_pending is set to true if any of the slots fail to - * persist. It is utilized by the SQL function pg_sync_replication_slots(). + * persist. * * Returns TRUE if the local slot is updated. */ @@ -911,15 +911,8 @@ synchronize_one_slot(RemoteSlot *remote_slot, Oid remote_dbid, * If slot_names is NIL, fetches all failover logical slots from the * primary server, otherwise fetches only the ones with names in slot_names. * - * Parameters: - * wrconn - Connection to the primary server - * slot_names - List of slot names (char *) to fetch from primary, - * or NIL to fetch all failover logical slots. - * - * Returns: - * List of remote slot information structures. Returns NIL if no slot - * is found. - * + * Returns list of remote slot information structures, if any, otherwise, + * NIL if no slot is found. */ static List * fetch_remote_slots(WalReceiverConn *wrconn, List *slot_names) @@ -1054,18 +1047,13 @@ fetch_remote_slots(WalReceiverConn *wrconn, List *slot_names) /* * Synchronize slots. * - * Takes a list of remote slots and synchronizes them locally. Creates the - * slots if not present on the standby and updates existing ones. + * This function takes a list of remote slots and synchronizes them locally. It + * creates the slots if not present on the standby and updates existing ones. * - * Parameters: - * wrconn - Connection to the primary server - * remote_slot_list - List of RemoteSlot structures to synchronize. - * slot_persistence_pending - boolean used by SQL function - * pg_sync_replication_slots() to track if any slots - * could not be persisted and need to be retried. + * If slot_persistence_pending is not NULL, it will be set to true if one or + * more slots could not be persisted. * - * Returns: - * TRUE if any of the slots gets updated in this sync-cycle. + * Returns TRUE if any of the slots gets updated in this sync-cycle. */ static bool synchronize_slots(WalReceiverConn *wrconn, List *remote_slot_list, @@ -1981,6 +1969,7 @@ extract_slot_names(List *remote_slots) * * Repeatedly fetches and updates replication slot information from the * primary until all slots are at least "sync ready". + * * Exits early if promotion is triggered or certain critical * configuration parameters have changed. */ @@ -2042,7 +2031,6 @@ SyncReplicationSlots(WalReceiverConn *wrconn) /* wait before retrying again */ wait_for_slot_activity(some_slot_updated); - } if (slot_names)