Based on the knowledge sources, the error you're encountering ("Saved offset is before replication slot's confirmed lsn") is a known issue with the Postgres CDC connector, particularly with versions 3.6.19 and later. Here's what's happening and how to address it: ## Root Cause The issue is related to how the Postgres connector handles LSN (Log Sequence Number) state management. According to [this GitHub issue](
https://github.com/airbytehq/airbyte/issues/49802), starting from version 3.6.19, the connector uses a newer version of the PgJDBC driver (42.7.0+) that automatically flushes the LSN even when there are no changes in the publication tables, causing the saved offset to fall behind the confirmed flush LSN. Additionally, [another issue](
https://github.com/airbytehq/airbyte/issues/49803) describes how the connector commits an LSN value that's higher than what gets saved in the state during the initial snapshot, leading to subsequent sync failures. ## Solutions ### 1. Downgrade the Connector (Immediate Fix) Multiple users have reported success by downgrading to
version 3.6.18, which doesn't have this LSN flushing issue. As mentioned in [this comment](
https://github.com/airbytehq/airbyte/issues/55846), "reverting to connector version 3.6.18 resolved this for me." ### 2. Implement Heartbeat Query (Recommended Long-term) Configure a heartbeat query to ensure regular WAL activity. According to the [troubleshooting documentation](
https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#advanced-wal-disk-consumption-and-heartbeat-action-query): 1. Create a heartbeat table:
sql CREATE TABLE airbyte_heartbeat ( id SERIAL PRIMARY KEY, timestamp TIMESTAMP NOT NULL DEFAULT current_timestamp, text TEXT );
2. Add it to your publication:
sql ALTER PUBLICATION <publicationName> ADD TABLE airbyte_heartbeat;
3. Configure the "Debezium heartbeat query" in your Postgres source connector:
sql INSERT INTO airbyte_heartbeat (text) VALUES ('heartbeat')
This solution has been confirmed to work by users experiencing similar issues, as noted in [this GitHub issue](
https://github.com/airbytehq/airbyte/issues/46571). ### 3. Adjust WAL Settings While you already have
wal_keep_size=400 MB
, you might need to increase it further or set
max_slot_wal_keep_size
to ensure WAL files aren't purged before Airbyte can process them.
Note: This is a known bug affecting versions 3.6.19 and later, and [users have reported](
https://github.com/airbytehq/airbyte/issues/55846) that it blocks production upgrades. The heartbeat solution or downgrading to 3.6.18 are currently the most reliable workarounds.