hello <@U04S8PLJWMT> I am facing the "Failure in s...
# ask-ai
a
hello @kapa.ai I am facing the "Failure in source: Saved offset is before replication slot's confirmed lsn" error.
k
The error "Failure in source: Saved offset is before replication slot's confirmed lsn" is a common issue when using Airbyte's Postgres source connector with Change Data Capture (CDC). This error means that the LSN (Log Sequence Number) Airbyte last saved is no longer available in the replication slot, usually because the required WAL (Write-Ahead Log) segments have been recycled or removed by Postgres before Airbyte could read them. Common Causes and Solutions: 1. WAL Retention Too Short / Syncs Too Infrequent: If Airbyte does not sync frequently enough, or if the WAL retention settings in Postgres are too low, the WAL segments needed for CDC may be deleted before Airbyte can process them. Solution: - Increase the
wal_keep_size
and/or
max_slot_wal_keep_size
in your Postgres configuration to retain WAL logs longer. - Increase the sync frequency in Airbyte so that WAL segments are read before they are recycled. - See [Airbyte Postgres Troubleshooting](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#under-cdc-incremental-mode-there-are-still-full-refresh-syncs) for more details. 2. Replication Slot Recreation or Failover Events: If the replication slot is dropped and recreated (e.g., after a Postgres failover or upgrade), the new slot will not have the old LSN, causing this error. Solution: - After recreating the slot, you may need to reset the Airbyte connection or perform a full resync. - Be aware that this can lead to data loss for deletes or changes that occurred during the downtime, as Airbyte will only capture the current state, not the changes that happened while the slot was missing. - See the discussion on [Azure PG Flex failover and data loss](https://github.com/airbytehq/airbyte/issues/29333). 3. Connector or JDBC Version Issues: Some versions of the Postgres JDBC driver (PgJDBC) used by Airbyte can cause the replication slot's confirmed_flush_lsn to advance unexpectedly, especially if there are no changes in the publication tables but other tables are busy. Solution: - If you recently upgraded Airbyte or the Postgres connector and started seeing this issue, consider downgrading the connector to a version before 3.6.19 or using a PgJDBC version below 42.7.0, as described in [this issue](https://github.com/airbytehq/airbyte/issues/49802). 4. Resetting the Connection: Sometimes, simply resetting the Airbyte connection or deleting and recreating it can resolve the issue, but this will trigger a full refresh and may not be suitable if you need to preserve CDC history. - See user reports of this workaround [here](https://github.com/airbytehq/airbyte/issues/46571). Summary of Steps to Try: - Increase WAL retention settings in Postgres. - Increase Airbyte sync frequency. - Reset the Airbyte connection if the error persists. - If using a recent connector version, consider downgrading as a temporary workaround. If you continue to experience this issue after trying the above, please provide more details about your setup (connector versions, Postgres version, sync frequency, and WAL settings) for more targeted troubleshooting. References: - [Airbyte Postgres Troubleshooting](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#under-cdc-incremental-mode-there-are-still-full-refresh-syncs) - [Github Issue: Saved offset is before replication slot's confirmed LSN](https://github.com/airbytehq/airbyte/issues/46571) - [CDC Not Working With Connector Version 3.6.22 (PgJDBC Issue)](https://github.com/airbytehq/airbyte/issues/49802) - [Azure PG Flex failover and data loss](https://github.com/airbytehq/airbyte/issues/29333)
a
OK. @kapa.ai • I have increased the sync frequency to every 30 minuts • I am using an older version of Postgres source (i.e. 3.6.18) • I have increased the wal_retention to 4096 Even with these changes once the error appears it is not possible to get rid of it unless performing a reset and/or recreating the replication slot Isn't there any way to manually advance /set the replications lsn?
k
A message from kapa.ai
Based on the information in the knowledge sources, there is currently no officially supported way in Airbyte to manually advance or set the replication slot's LSN to match a specific value after the "Saved offset is before replication slot's confirmed lsn" error occurs. The standard and recommended recovery is to reset the connection or recreate the replication slot, which will trigger a full refresh and re-initialize the sync from the current state of the database. This is confirmed in both the [Airbyte documentation](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#under-cdc-incremental-mode-there-are-still-full-refresh-syncs) and multiple GitHub issues, where users and contributors state that a reset is required to recover from this state. There is some discussion in the community about the possibility of using Postgres functions like
pg_replication_origin_advance
to manually advance the replication origin to a specific LSN, but this is not part of Airbyte's documented or supported workflows. One user suggested this approach in the context of Azure PG failover, but it was presented as a theoretical solution, not a tested or recommended practice within Airbyte. The risk is that manually advancing the LSN could lead to data loss or inconsistencies, especially for CDC use cases where deleted or changed records might be missed if the WAL gap is not handled correctly. See the discussion here: [Missing replication slot caused by Azure PG Flex Server failover event leads to data loss](https://github.com/airbytehq/airbyte/issues/29333). In summary: - The only supported recovery is to reset the connection or recreate the replication slot, which will trigger a full refresh. - There is no built-in or documented way in Airbyte to manually set or advance the replication slot's LSN. - Attempting to manually advance the LSN outside of Airbyte is not recommended and may result in data loss or sync inconsistencies. If this limitation is a blocker for your use case, you may want to follow or contribute to the related GitHub issues to advocate for a feature that allows more granular control over LSN recovery in the future.
a
ok @kapa.ai I have reseted the connector using the API: /v1/connections/reset If I am not wrong this will trigger a clear data. After that, what should I do: press the sync button or rather Refresh your data?
k
A message from kapa.ai
After you reset the connector using the API (
/v1/connections/reset
), this action will clear all previously synced data from your destination for that connection—this is equivalent to a "Clear" operation in the Airbyte UI and documentation as of version 1.0.0 and later. Once the clear is complete, your destination tables will be empty, and you will need to initiate a sync to repopulate them with data from your source. Next step: You should initiate a regular sync (press the "Sync" button or trigger a sync via the API). This will backfill all historical data from your source into the destination. There is no need to use "Refresh your data" after a clear/reset, as the clear operation already removes all data, and the next sync will reload everything from scratch. > "In order to backfill all historical data, a sync should be initiated after your clear succeeds." > [Clearing your data – Operator Guides](https://docs.airbyte.com/platform/operator-guides/clear) So, after a reset/clear, simply trigger a sync to reload your data. "Refresh your data" is not required in this context, as the clear has already prepared your destination for a full reload.
a
ok @kapa.ai I read that a full-refresh does not use the replication slot. IS that true?
k
A message from kapa.ai
Yes, that is correct: during a full refresh sync, Airbyte does not use the replication slot or the transaction log (WAL). Instead, it performs a
SELECT
statement to take a snapshot of the current state of the data in your source database. The replication slot and WAL are only used for incremental syncs with CDC enabled, where changes are read from the log since the last sync. This is confirmed in the documentation: > The first time the sync is run, a snapshot of the current state of the data will be taken. This snapshot is created with a
SELECT
statement and is effectively a Full Refresh (meaning changes won't be logged). Subsequent syncs will use the logs to determine which changes took place since the last sync and update those. Airbyte keeps track of the current log position between syncs. > [Understanding Airbyte CDC](https://docs.airbyte.com/platform/understanding-airbyte/cdc) So, full refresh does not use the replication slot; only CDC incremental syncs do.
a
so, @kapa.ai in the first sync or after a rest, if I press sync it will use the replication slot but if i press the refresh button it will not?
k
A message from kapa.ai
Based on the knowledge sources, after a reset (or on the very first sync), Airbyte performs a full refresh sync. This initial sync does not use the replication slot or the WAL; it simply selects all data from the source tables using standard SQL queries (e.g.,
SELECT * FROM table
). The replication slot is only used for subsequent incremental CDC syncs, not for the initial full refresh after a reset. - First sync after reset: Does not use the replication slot; it takes a snapshot of the current state using a
SELECT
statement. - Subsequent incremental syncs: Use the replication slot and WAL to capture changes since the last sync. The documentation states: > The first time the sync is run, a snapshot of the current state of the data will be taken. This snapshot is created with a
SELECT
statement and is effectively a Full Refresh (meaning changes won't be logged). Subsequent syncs will use the logs to determine which changes took place since the last sync and update those. Airbyte keeps track of the current log position between syncs. > [Change Data Capture (CDC)](https://docs.airbyte.com/platform/understanding-airbyte/cdc) Regarding the Refresh button: The knowledge sources do not explicitly differentiate between pressing "Sync" and "Refresh" after a reset in terms of replication slot usage. However, both actions after a reset will trigger a full refresh, which, as described, does not use the replication slot. Only after the initial full refresh is complete will incremental CDC syncs (triggered by "Sync" or scheduled runs) use the replication slot. Summary: - After a reset, the first sync (whether triggered by "Sync" or "Refresh") does not use the replication slot. - Only subsequent incremental syncs use the replication slot and WAL. If you need more details about the difference between "Sync" and "Refresh" buttons specifically, the knowledge sources do not provide further clarification.
a
@kapa.ai i have seen that sometimes Debezium does not update the LSN in the db-airbyte. Is there any way to force Debezium update the LSN?
k
A message from kapa.ai
I'm sorry, but the knowledge sources do not provide a documented or supported way to force Debezium to update the LSN (Log Sequence Number) in the Airbyte database manually. However, there are several related observations and workarounds discussed: - Heartbeat Workaround: Some users have found that configuring a Debezium heartbeat query in the Airbyte source settings can help advance the LSN, especially in low-traffic databases. This involves creating a heartbeat table, adding it to the publication, and setting a query (such as an
UPDATE
or
INSERT
) that Airbyte will periodically execute. This can "force" activity and help Debezium/CDC advance the LSN and save state more reliably. [See documentation and user reports](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#advanced-wal-disk-consumption-and-heartbeat-action-query) and [user comments](https://github.com/airbytehq/airbyte/issues/47547). - Limitation: Even with heartbeats, there are cases where Debezium does not update the LSN in Airbyte's state if no new records are produced, or if the sync completes without any changes being captured. This is a known issue and has been discussed in GitHub issues, but there is no official method to "force" a state update outside of generating new changes in the source database or using the heartbeat workaround. [See related issue](https://github.com/airbytehq/airbyte/issues/48435). Summary: There is no direct or supported way to force Debezium to update the LSN in Airbyte. The best available workaround is to use a heartbeat table and query to ensure regular changes are captured, which can help advance and persist the LSN in the Airbyte state. If this does not resolve your issue, it is a known limitation, and further manual intervention is not documented in the knowledge sources.
a
changing topics @kapa.ai which would you say are the most critical workloads (deployments, statefulsets, etc) in airbyte?
k
A message from kapa.ai
The most critical workloads (deployments, statefulsets, etc.) in Airbyte are those that make up the core platform and are essential for orchestrating and running data movement operations. According to the architecture overview in the knowledge sources, these include: - airbyte-webapp: The web UI for interacting with Airbyte. - airbyte-server / airbyte-server-api: The main controller, responsible for all configuration and orchestration operations. - airbyte-db: The database that stores configuration and job history (often deployed as a StatefulSet for persistence). - airbyte-temporal: Manages scheduling and sequencing of task queues and workflows. - airbyte-worker: Executes connection scheduling and sequencing logic, and interacts with the workload API. - airbyte-workload-api-server: The HTTP interface for enqueuing workloads (the discrete pods that run connector operations). - airbyte-workload-launcher: Launches workloads (pods) in Kubernetes based on events from the workload API. For high availability, it is particularly recommended to run multiple instances of the
worker
and
server
pods, as these are critical for job execution and orchestration. The database (
airbyte-db
) is also critical, and a primary-replica setup is suggested for resilience and data availability. Other components like
airbyte-cron
and
airbyte-bootloader
are important for maintenance and initialization but are not as critical for steady-state operation as the above components. > "We particularly recommend having multiple instances of
worker
and
server
pods... you may want to implement a primary-replica setup for the database (e.g., PostgreSQL) used by Airbyte." > [Scaling Airbyte After Installation – High Availability](https://docs.airbyte.com/platform/enterprise-setup/scaling-airbyte#high-availability) In summary, the most critical workloads are: -
airbyte-server
-
airbyte-worker
-
airbyte-db
(database) -
airbyte-temporal
-
airbyte-workload-api-server
-
airbyte-workload-launcher
These components are essential for Airbyte's core functionality and should be prioritized for scaling and high availability deployments [Architecture overview](https://docs.airbyte.com/platform/understanding-airbyte/high-level-view).
a
@kapa.ai if there is a disruption or a redeployment in airbyte-serve, would this affect to my current connections or Debezium updating LSN?
k
A message from kapa.ai
If there is a disruption or redeployment of the
airbyte-server
, the knowledge sources do not provide explicit details about the immediate impact on running connections or Debezium's LSN updates. However, based on the architecture, the
airbyte-server
is primarily responsible for orchestration, configuration, and API endpoints, while the actual sync jobs (including Debezium-based CDC operations) are executed by the
airbyte-worker
pods and the workload pods that run the connectors themselves. This means that a temporary disruption or redeployment of
airbyte-server
should not directly interrupt running sync jobs or Debezium's process of updating the LSN, as those are managed by the worker and workload pods. However, you may experience issues with starting new syncs, managing connections, or interacting with the Airbyte UI/API during the downtime of the server component. For high availability, it is recommended to run multiple instances of the
airbyte-server
to minimize the risk of such disruptions affecting your operations [Scaling Airbyte After Installation – High Availability](https://docs.airbyte.com/platform/enterprise-setup/scaling-airbyte#high-availability). In summary: - Ongoing syncs and Debezium LSN updates are handled by worker and workload pods, not directly by
airbyte-server
. - Disruption of
airbyte-server
may affect orchestration and management, but not the execution of already running syncs. - The knowledge sources do not mention any direct impact on Debezium LSN updates from a
airbyte-server
redeployment, but high availability is recommended for critical workloads.
a
@kapa.ai from these critiacal applicattions you comment: -
airbyte-server
-
airbyte-worker
-
airbyte-temporal
-
airbyte-workload-api-server
-
airbyte-workload-launcher
Which would affect or lead to connection error
k
A message from kapa.ai
Based on the knowledge sources, the following critical Airbyte components could lead to connection errors if they are disrupted: - airbyte-server: This is the main controller for all operations in Airbyte, including creating sources, destinations, and managing configurations. If this service is down, you may not be able to create or manage connections, and API/UI interactions will fail. However, already running sync jobs may continue if the workers and workload pods are unaffected, but new jobs cannot be scheduled or managed during the downtime [Architecture overview](https://docs.airbyte.com/platform/1.7/understanding-airbyte/high-level-view). - airbyte-worker: Responsible for executing the connection scheduling and sequencing logic. If this service is unavailable, jobs will not be executed, which can result in connection errors or failed syncs [Architecture overview](https://docs.airbyte.com/platform/1.7/understanding-airbyte/high-level-view). - airbyte-temporal: Manages the scheduling and sequencing of task queues and workflows. If Temporal is down, job orchestration and workflow management will fail, leading to connection errors or stalled jobs [Architecture overview](https://docs.airbyte.com/platform/1.7/understanding-airbyte/high-level-view). - airbyte-workload-api-server: This is the HTTP interface for enqueuing workloads (the pods that run connector operations). If it is unavailable, new jobs cannot be enqueued, which can result in connection errors when trying to start syncs [Architecture overview](https://docs.airbyte.com/platform/1.7/understanding-airbyte/high-level-view). - airbyte-workload-launcher: Responsible for launching the actual workload pods in Kubernetes. If this component is down, jobs will not be started, leading to connection errors or jobs stuck in a pending state [Architecture overview](https://docs.airbyte.com/platform/1.7/understanding-airbyte/high-level-view). Summary: A disruption in any of these components can lead to connection errors, either by preventing new connections/syncs from being created or by interrupting the execution of existing jobs. The most immediate impact on connection errors would come from disruptions to
airbyte-server
,
airbyte-worker
, and
airbyte-temporal
, as these are directly involved in job orchestration and execution.