EDB is pleased to announce the release of PG Failover Slots (pg_failover_slots). This database extension is released as open source software under the PostgreSQL license and is for anyone who has logical replication publications on Postgres databases that are also part of a Streaming Replication architecture.
PG Failover Slots avoids the need for logical replication subscribers to reseed their logical replication tables when the logical replication publisher is part of a physical streaming replication architecture and a new Standby gets promoted to Primary.
Since the replication slot used by logical replication is only maintained on the Primary node, downstream subscribers will not receive any new changes from the newly promoted Primary until the slot is created on the newly promoted Primary. Picking up logical replication changes from the newly promoted standby is unsafe because the information that includes which data a subscriber has confirmed receiving and which log data still needs to be retained for the subscriber will have been lost, resulting in an unknown gap in data. PG Failover Slots makes logical replication slots usable across a physical failover via the following features in the initial release: * Copies any missing replication slots from the primary to the standby * Removes any slots from the standby that aren't found on the primary * Periodically synchronizes the position of slots on the standby based on the primary * Ensures that selected standbys receive data before any of the logical slot walsenders can send data to consumers