Excessive WAL Build Up
Issue
The connector is not releasing the write-ahead log (WAL) files accumulating in the pg_wal
directory.
Environment
Connector: PostgreSQL
Resolution
Option 1: Identify and address ongoing transactions
- In your database, check for ongoing transactions by executing the following queries:
SELECT pg_xact_changes(<STALLED_TXID>); SELECT * FROM pg_replication_slots; SELECT * FROM pg_stat_activity; SELECT * FROM pg_prepared_xacts; SELECT * FROM pg_prepared_statements;
- Terminate or resolve the ongoing transactions.
Option 2: Drop and re-create the replication slot
- In Fivetran, go to your PostgreSQL connector page.
- In the top right corner, pause your connector by setting the ENABLED toggle to OFF.
- In your database, drop the existing replication slot and wait for checkpoints to complete.
- Create a new replication slot.
- On your Fivetran connector page, select the Setup tab.
- Next to Re-sync All Historical Data, select Click to re-sync all historical data from your source.
- In the confirmation pop-up window, click Re-sync Connector.
- Unpause your connector by setting the ENABLED toggle to ON.
Option 3: Allow the sync to continue
- Check how much disk space you have available.
- Add more disk space as needed.
- Allow the sync to continue.
Cause
This issue occurs when incremental syncs takes longer than expected, causing the WAL to build up and consume a lot of disk space. This may happen for one of the following reasons:
- There are a lot of tables included in the connector schema.
- There is a high rate of change in the source database.
- The WAL slot is not advancing due to ongoing transactions.