Error: Error With Logical Replication
Issue
Setup tests fail. The following error appears.
Error with logical replication. This error occurs when the replication slot conflicted with recovery (and so is now invalidated)
Environment
- Connector: PostgreSQL
- Update method: Logical replication
Resolution
To resolve this issue, do the following:
In PostgreSQL, set the
hot_standy_feedback
parameter toon
to prevent replication slots from being invalidated in the future. For more information, see PostgreSQL's Hot Standy documentationRestart your PostgreSQL instance or reload the configuration for the change to take effect.
Drop the invalid replication slot from your PostgreSQL database.
Create a new replication slot. For more information, see step 10 under the Logical replication section of our Configure incremental sync method documentation.
Update the connection with the new slot details.
i. In Fivetran, go to your PostgreSQL connection page.
ii. Select the Setup tab.
iii. Click Edit connection.
iv. Update the Replication Slot and Publication Names fields with the new information.
v. Click Save & Test.
Cause
This issue occurs when the logical replication slot configured for your PostgreSQL connection is invalid or no longer exists. This may happen for one of the following reasons:
- The replication slot was created incorrectly or has been deleted.
- PostgreSQL performed a recovery process, causing existing replication slots to be invalidated.
In addition, if the hot_standby_feedback
parameter is set to off
, PostgreSQL may vacuum essential data needed for replication, potentially causing replication interruptions or data gaps. Enabling hot_standby_feedback
prevents data loss due to vacuuming, though it does not prevent slot invalidation during recovery events.