<@U04S8PLJWMT> I activated CDC on a RDS postgresql...
# ask-ai
p
@kapa.ai I activated CDC on a RDS postgresql instance, and it says that the slot is inactive and that's causing my replication logs to explode. I tried syncing again, it didn't make the slot active nor reduce the retained_wal. How do I fix this?
k
When the replication slot on your RDS PostgreSQL instance is "inactive," it means that no client (such as Airbyte) is currently connected and consuming changes from the slot. As a result, PostgreSQL retains all WAL (Write-Ahead Log) files needed for that slot, causing disk usage to grow rapidly. Simply triggering a sync in Airbyte may not always resolve this if the connector is not properly consuming from the slot. How to fix this: 1. Ensure Airbyte is Actively Syncing - The replication slot's
active
status should be
true
while Airbyte is running a sync. If it remains
false
even during a sync, it suggests Airbyte is not connecting to the slot correctly. Double-check your Airbyte connection configuration, especially the replication slot name and publication settings. Try dropping and recreating the slot and publication, then reconfigure your Airbyte source to use the new slot and publication. Some users have reported that rebuilding the Airbyte connection and ensuring only the intended tables are included in the publication can resolve this issue. Also, make sure you are using compatible versions of Airbyte and the Postgres connector, as older versions have had issues with CDC state management and slot consumption [source](https://github.com/airbytehq/airbyte/issues/47547). 2. Heartbeat/Artificial Changes for Low-Volume Tables - If your database has low transaction volume, the slot may not advance because there are no new changes to consume. In this case, WAL files accumulate. The recommended workaround is to create a "heartbeat" table and periodically update it, then add it to your publication. This ensures there is always at least one change for Airbyte to consume, which advances the slot and allows WAL cleanup. You can automate this with a cron job or use the Debezium heartbeat query in Airbyte's source configuration [source](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#advanced-wal-disk-consumption-and-heartbeat-action-query). Example steps:
Copy code
sql    CREATE TABLE airbyte_heartbeat (      id SERIAL PRIMARY KEY,      timestamp TIMESTAMP NOT NULL DEFAULT current_timestamp,      text TEXT    );    ALTER PUBLICATION <publicationName> ADD TABLE airbyte_heartbeat;
Then, in Airbyte's Postgres source settings, set the Debezium heartbeat query to:
Copy code
sql    INSERT INTO airbyte_heartbeat (text) VALUES ('heartbeat');
3. Check for Inactive Slots - If the slot is inactive when no sync is running, that's normal. But if it stays inactive during a sync, Airbyte is not connecting properly. You can check slot status with:
Copy code
sql    SELECT slot_name, active FROM pg_replication_slots;
If the slot never becomes active, review Airbyte logs for connection errors or misconfiguration [source](https://github.com/airbytehq/airbyte/issues/42917). 4. Clean Up Old/Unused Slots - If a slot is no longer needed or is stuck, drop it to release retained WAL:
Copy code
sql    SELECT pg_drop_replication_slot('your_slot_name');
Summary: - Make sure Airbyte is configured to use the correct slot and publication. - Use a heartbeat table if your database has low change volume. - Monitor the slot's
active
status during syncs. - Drop unused slots to free up disk space. If after these steps the slot still does not become active during syncs, there may be a deeper configuration or compatibility issue. In that case, upgrading Airbyte and the connector, and recreating the connection from scratch, has resolved the issue for some users [source](https://github.com/airbytehq/airbyte/issues/47547). For more details and troubleshooting, see the official Airbyte documentation: [Resolving sync failures due to WAL disk consumption](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#advanced-wal-disk-consumption-and-heartbeat-action-query).