<@U04S8PLJWMT> Failure in source: Saved offset is ...
# ask-ai
s
@kapa.ai Failure in source: Saved offset is before replication slot's confirmed lsn. Please reset the connection, and then increase WAL retention and/or increase sync frequency to prevent this from happening in the future. See https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#under-cdc-incremental-mode-there-are-still-full-refresh-syncs for more details. how to fix this
k
The error "Saved offset is before replication slot's confirmed lsn" in Airbyte's Postgres CDC connector indicates that the Write-Ahead Log (WAL) needed for incremental sync has been removed by Postgres. Based on the knowledge sources, here are several solutions: ## Immediate Fixes 1. Add a Heartbeat Table (Recommended for low-traffic databases) Create a heartbeat table and configure Airbyte to periodically insert records:
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 configure the "Debezium heartbeat query" in your Postgres source connector:
Copy code
sql    INSERT INTO airbyte_heartbeat (text) VALUES ('heartbeat')
This solution is detailed in the [(Advanced) 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) documentation. 2. Add High-Traffic Tables to Publication Add tables with high transaction volumes to your publication (you don't need to sync them):
Copy code
sql    ALTER PUBLICATION <publicationName> ADD TABLE <high_volume_table>;
## Connector Version Issues There are known bugs in certain connector versions. According to the knowledge sources: - Versions 3.6.19-3.6.33 have a critical bug where the connector commits the wrong LSN during initial snapshots, as described in [this issue](https://github.com/airbytehq/airbyte/issues/49803) - Version 3.6.34 contains the fix for this issue, as mentioned in [this comment](https://github.com/airbytehq/airbyte/issues/49803) - Some users report success by reverting to version 3.6.18 as noted in [this comment](https://github.com/airbytehq/airbyte/issues/55846) ## Configuration Changes 1. Change Invalid CDC Position Behavior: Set it to "Re-sync Data" instead of "Fail Sync" (though this may cause repeated full refreshes) 2. Increase WAL Retention:
Copy code
sql    ALTER SYSTEM SET wal_keep_size = '10GB';    ALTER SYSTEM SET max_slot_wal_keep_size = '10GB';
3. Increase Sync Frequency: Run syncs more frequently to prevent WAL files from being purged before they're consumed The most reliable solution appears to be upgrading to connector version 3.6.34 or later, combined with implementing the heartbeat table approach for databases with low transaction volumes.