```@kapa.ai Failure in source: Saved offset is bef...
# ask-ai
s
Copy code
@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.
for this issue what's the best method to resolve this error
k
The error message: > "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." indicates that Airbyte's saved offset (LSN) is behind the confirmed_flush_lsn of the replication slot. This usually happens when the required WAL (Write-Ahead Log) segments have been purged from Postgres before Airbyte could read them, often due to low sync frequency or insufficient WAL retention settings. Best methods to resolve this error: 1. Increase WAL Retention: - Raise the
wal_keep_size
and/or
max_slot_wal_keep_size
parameters in your Postgres configuration to ensure WAL files are retained long enough for Airbyte to read them. - Example:
Copy code
sql      ALTER SYSTEM SET wal_keep_size = '10GB';      ALTER SYSTEM SET max_slot_wal_keep_size = '10GB';
- This ensures WAL files are not purged before Airbyte can process them, especially important for infrequent syncs or large data volumes. 2. Increase Sync Frequency: - Run Airbyte syncs more frequently so that WAL segments are processed before they are purged by Postgres. 3. Add High-Volume Tables to the Publication (for low-traffic databases): - If your database has low transaction volume, WAL segments may not advance as expected. Adding a high-transaction table to the publication can help advance the LSN and prevent WAL buildup or purging issues. You do not need to sync this table, just include it in the publication. - Example:
Copy code
sql      ALTER PUBLICATION <publicationName> ADD TABLE <high_volume_table>;
- Alternatively, use a heartbeat table and configure Airbyte to periodically write to it, which will also advance the LSN. See the [heartbeat action query documentation](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#advanced-wal-disk-consumption-and-heartbeat-action-query) for details. 4. Reset the Connection: - If the error persists, reset the Airbyte connection. This will trigger a full refresh and reinitialize the replication slot and state. References: - [Troubleshooting: Under CDC incremental mode, there are still full refresh syncs](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#under-cdc-incremental-mode-there-are-still-full-refresh-syncs) - [Advanced WAL disk consumption and heartbeat action query](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#advanced-wal-disk-consumption-and-heartbeat-action-query) - [Github Issue: "Saved offset is before replication slot's confirmed LSN" error during Postgres to Kafka sync with CDC in Airbyte](https://github.com/airbytehq/airbyte/issues/46571) If you continue to see this error after making these changes, review your WAL retention settings and sync frequency, and consider implementing a heartbeat mechanism if your database has low write activity.
s
i'll do that but how do i sync it right now? @kapa.ai
k
A message from kapa.ai
Sorry @Surendra Longre, I'm currently experiencing some technical difficulties. Please try again in a few minutes. If this issue persists, please reach out to the administrators of this Slack workspace.