Error: Replication Slot Not Found
Issue
The following error appears:
Replication slot not found
Environment
- Connector: PostgreSQL
- Plug-in:
pg_output
Answer
- Connect to the instance you have provided details for in the Fivetran setup form.
- Run
SELECT * FROM pg_replication_slots;
to print the details of the available replication slots. - If you do not see the replication slot under the
slot_name
column then the slot does not exist. There are two potential reasons for this:- The slot has not been created yet.
- The slot cannot be created as you are connected to a replica. Common cloud implementations of PostgreSQL do not allow the addition of logical slots on replicas. In this case you will need to adjust the setup form parameters to connect to the primary or use a different sync strategy.
- If you do see the slot under the
slot_name
column, check thedatabase
column. This should match the database that you have added in the setup form. The solution in this case is as follows:- When connected to the database cluster, connect to the correct database in PostgreSQL using
\c <database-name>
. - Create the logical slot as normal as described in the setup documentation.
- Drop the replication slot created on the incorrect database. An unused slot will continue to hold on to the Write Ahead Log forever which can cause server bloat.
- Add the newly created slot to the setup form and re-run the setup tests. A historical re-sync will be required here as newly created slots only start tracking changes after their creation.
- When connected to the database cluster, connect to the correct database in PostgreSQL using
Cause
The slot is not created or not visible to the sync process when it connects to your database.