Summary
PostgreSQL 17 introduced failover slots (CREATE_REPLICATION_SLOT ... (FAILOVER)), which allow logical replication slots to be synchronized to physical standbys. When a standby is promoted, the slot survives with its confirmed_flush_lsn intact, enabling subscribers to reconnect without a full resnapshot.
Readyset should use this option when creating replication slots on PG17+ servers. This is a small change that gives free failover resilience.
Current behavior
Readyset creates replication slots with:
CREATE_REPLICATION_SLOT <name> LOGICAL pgoutput EXPORT_SNAPSHOT
When the primary fails over to a standby, the slot is lost, and Readyset must do a full resnapshot against the new primary.
Proposed change
When server_version_num >= 170000, use the PG17 parenthesized option syntax with the FAILOVER flag:
CREATE_REPLICATION_SLOT <name> LOGICAL pgoutput (FAILOVER, SNAPSHOT 'export')
For older versions, keep the existing syntax unchanged.
Files to change
replicators/src/postgres_connector/connector.rs — create_replication_slot(): accept version parameter, conditionally add FAILOVER
replicators/src/noria_adapter.rs — pass version_num through to create_replication_slot()
Impact
- PG17+: Slot survives failover to a promoted standby → no resnapshot needed
- PG < 17: No change in behavior (existing full-resnapshot fallback still works)
Summary
PostgreSQL 17 introduced failover slots (
CREATE_REPLICATION_SLOT ... (FAILOVER)), which allow logical replication slots to be synchronized to physical standbys. When a standby is promoted, the slot survives with itsconfirmed_flush_lsnintact, enabling subscribers to reconnect without a full resnapshot.Readyset should use this option when creating replication slots on PG17+ servers. This is a small change that gives free failover resilience.
Current behavior
Readyset creates replication slots with:
When the primary fails over to a standby, the slot is lost, and Readyset must do a full resnapshot against the new primary.
Proposed change
When
server_version_num >= 170000, use the PG17 parenthesized option syntax with theFAILOVERflag:For older versions, keep the existing syntax unchanged.
Files to change
replicators/src/postgres_connector/connector.rs—create_replication_slot(): acceptversionparameter, conditionally addFAILOVERreplicators/src/noria_adapter.rs— passversion_numthrough tocreate_replication_slot()Impact