we are facing "CRM db sync failure: Saved offset i...
# ask-ai
n
we are facing "CRM db sync failure: Saved offset is before replication slot's confirmed lsn" with our Postgres to BigQuery connection it requires a full airbyte refresh which deletes some of our historic data are there any information on how to fix this issue without full aribyte refresh and how to avoid it from happening
k
The error "Saved offset is before replication slot's confirmed lsn" in your Postgres to BigQuery CDC sync is a known issue in Airbyte, especially with recent versions of the Postgres source connector. This error typically forces a full refresh, which can result in loss of historic data (such as deletes that occurred between the last successful sync and the refresh) because a full refresh only captures the current state of the tables, not the changes that happened in between. ### Why does this happen? - WAL (Write-Ahead Log) Retention: If the WAL segments required for incremental sync are removed by Postgres before Airbyte can read them, the saved offset (LSN) is no longer available, and Airbyte cannot continue from where it left off. This triggers a full refresh. This can happen if: - The sync frequency is too low. - The WAL retention settings (
wal_keep_size
,
max_slot_wal_keep_size
) are too small for your database's write volume. - Connector Bugs: There are also known bugs in recent versions of the Airbyte Postgres connector (starting from v3.6.19 and above) related to how the LSN is saved and how the JDBC driver interacts with Debezium, which can cause this error even if WAL retention is sufficient. See [this issue](https://github.com/airbytehq/airbyte/issues/49802) and related discussions. ### How to avoid this issue 1. Increase WAL Retention and Sync Frequency - Set
wal_keep_size
and
max_slot_wal_keep_size
to higher values to ensure WAL segments are retained long enough for Airbyte to read them. - Increase the sync frequency so that Airbyte reads the WAL before it is purged. - Example Postgres settings:
Copy code
sql      ALTER SYSTEM SET wal_keep_size = '10GB';      ALTER SYSTEM SET max_slot_wal_keep_size = '10GB';
- See more: [Postgres Troubleshooting Docs](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#under-cdc-incremental-mode-there-are-still-full-refresh-syncs) 2. Add a Heartbeat Table or High-Volume Table to the Publication - If your tables have low write volume, WAL segments may not advance as expected. Add a high-transaction table to the publication or use a heartbeat table that Airbyte can write to, and configure the Debezium heartbeat query. This keeps the replication slot active and the LSN advancing. - See step-by-step: [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) 3. Connector Version Workarounds - If you are using source-postgres connector v3.6.19 or later and are experiencing this issue, consider downgrading to v3.6.18, as newer versions have a known incompatibility with the latest PgJDBC driver and Debezium ([see issue](https://github.com/airbytehq/airbyte/issues/49802)). Many users report that downgrading resolves the problem. 4. Do Not Remove or Recreate Replication Slots Unnecessarily - If the replication slot is dropped (e.g., due to a failover or manual intervention), Airbyte will be forced to do a full refresh, and you may lose CDC data that occurred during the downtime. There is currently no built-in way in Airbyte to resume from a specific LSN after a slot is recreated ([see discussion](https://github.com/airbytehq/airbyte/issues/29333)). ### Can you fix it without a full refresh? Currently, if the WAL segments required for the saved offset are gone, Airbyte cannot resume incremental sync and must do a full refresh. There is no supported way to manually set the starting LSN in Airbyte to recover only the missing changes. Some users have suggested advanced manual interventions (e.g., manipulating the state in the Airbyte database), but these are not officially supported and can be risky. ### Summary - Increase WAL retention and sync frequency. - Add a heartbeat or high-volume table to the publication. - Consider downgrading the Postgres connector to v3.6.18 if you are on a newer version. - Avoid dropping replication slots. - If the error occurs, a full refresh is currently required. For more details and troubleshooting steps, see the official Airbyte documentation and referenced GitHub issues: - [Postgres Troubleshooting Docs](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) - [CDC Not Working With Connector Version 3.6.22 (PgJDBC Issue)](https://github.com/airbytehq/airbyte/issues/49802) - [CDC sync is making the confirmed flush LSN to a value > saved state LSN](https://github.com/airbytehq/airbyte/issues/55846) If you need to avoid data loss from deletes or updates that occurred during the downtime, you may need to consider alternative CDC tools or request enhancements from the Airbyte team.
n
@kapa.ai, we use rostgres to bq connector. Before full refresh we copied our bq data, performed full refresh and later ingested copied data back into bq table. Everything was working fine for 2 weeks, there were many airbyte sync runs, but after 2 weeks the data we manually ingested disappeared andd all data added by Airbyte was still there. What might be the reason? Can non-breaking schema change affect it ( 1 column was deleted in our source)?
k
A message from kapa.ai
Based on the information in the knowledge sources, here’s what likely happened: When you performed a full refresh in Airbyte, the destination table in BigQuery was overwritten with the current state of your source data. After the full refresh, you manually ingested (copied) data back into the BigQuery table. For two weeks, Airbyte incremental syncs ran and your manually ingested data remained. However, after some time, your manually ingested data disappeared, while data added by Airbyte remained. Possible reasons: 1. Airbyte Overwrites Data Not Present in the Source: If your Airbyte connection is set to use the "Full Refresh - Overwrite" sync mode, every time a full refresh occurs, Airbyte will overwrite the entire destination table with the current state of the source. Any data in BigQuery that is not present in the source (including your manually ingested data) will be deleted during this process. Even if you are using incremental sync, if a full refresh is triggered (manually or due to a breaking schema change), this overwrite will happen and remove any extra data not present in the source. [See: Full Refresh Overwrite behavior](https://docs.airbyte.com/platform/1.7/using-airbyte/core-concepts/sync-modes/full-refresh-overwrite) 2. Non-breaking Schema Change (Column Deletion): Deleting a column in the source is considered a non-breaking schema change. According to Airbyte documentation, when a column is removed from the source, the old field will be retained in the destination but will stop updating with new values. If the connection is ever cleared or refreshed, the field and its historical data will be removed entirely. This means that if a full refresh or a schema refresh occurred after the column was deleted, it could have triggered the removal of data associated with that column, and possibly a reset of the table, which would again remove any manually ingested data not present in the source. [See: Schema Change Management](https://docs.airbyte.com/platform/1.7/using-airbyte/schema-change-management) 3. Incremental Sync and Data Deletion: If you are using incremental sync, Airbyte only appends or updates data based on the source. It does not delete records from the destination unless a full refresh or a reset is triggered. However, if a schema change (even non-breaking) is detected and you approve or propagate it, Airbyte may prompt or require a refresh/reset, which can lead to data loss for records not present in the source. [See: Schema Change Propagation](https://docs.airbyte.com/platform/1.7/using-airbyte/schema-change-management#detect-and-propagate-schema-changes-connection-setting) Summary: Your manually ingested data likely disappeared because a full refresh or a schema refresh/reset was triggered (possibly due to the column deletion in the source), causing Airbyte to overwrite the destination table with only the data present in the source. Non-breaking schema changes like column deletion can lead to this if a refresh/reset is performed after the change. Recommendation: To prevent this in the future, avoid manually adding data to Airbyte-managed tables in your destination, as Airbyte assumes full control over those tables and may overwrite them during syncs, especially after schema changes or full refreshes. If you need to retain manually added data, consider storing it in a separate table or partition outside of Airbyte’s control. [Reference: Airbyte Schema Change Management](https://docs.airbyte.com/platform/1.7/using-airbyte/schema-change-management)
n
@kapa.ai, 1. Would there be any trace of full refresh that might have deleted the data in logs or anywhere else? 2. In case of " causing Airbyte to overwrite the destination table with only the data present in the source." why all previous syncs where still in our destination table and not only latest sync that is currently present in the source?
k
A message from kapa.ai
1. Would there be any trace of full refresh that might have deleted the data in logs or anywhere else? The knowledge sources do not explicitly mention where or how to find traces of a full refresh event in Airbyte logs or UI. However, Airbyte does document that a full refresh operation replaces all data in the destination table with the current state from the source, and this is a significant operation. While it is reasonable to expect that such operations would be logged (especially in the Airbyte job logs or sync history), the documentation does not provide details on log locations or specific audit trails for full refresh events. Therefore, I cannot confirm with certainty where you would find such traces based on the provided sources. 2. In case of "causing Airbyte to overwrite the destination table with only the data present in the source," why were all previous syncs still in our destination table and not only the latest sync that is currently present in the source? According to the documentation, when using Full Refresh - Overwrite mode, Airbyte replaces all data in the destination table with the data currently present in the source at the time of the sync. This means that after a full refresh, the destination should only contain the data from the latest sync, not a cumulative history of all previous syncs. If you observed that all previous syncs' data remained in the destination table after a full refresh, this would be unexpected based on the documented behavior. The only exception would be if you were using a sync mode like Full Refresh - Append, which appends new data without deleting existing data, but this is not the default for overwrite modes. The documentation is clear that Overwrite mode does not retain old data: > "In the Overwrite variant, new syncs will destroy all data in the existing destination table and then pull the new data in. Therefore, data that has been removed from the source after an old sync will be deleted in the destination table." [Full Refresh - Overwrite](https://docs.airbyte.com/platform/1.7/using-airbyte/core-concepts/sync-modes/full-refresh-overwrite) If you saw all previous syncs' data in the destination, it suggests that either a full refresh did not actually occur, or a different sync mode (such as Append) was used. The knowledge sources do not provide further details on why this might happen outside of the documented sync mode behaviors. --- Summary: - The documentation does not specify where to find logs or traces of a full refresh event. - In Full Refresh - Overwrite mode, only the latest source data should be present after a full refresh; if more data remained, it may indicate a different sync mode or that a full refresh did not occur as expected.
n
@kapa.ai in case our destination table is partitioned by day, and i simply used insert * from table_copy to destination_table, would that cause such behaviour ? I'm not sure if simple data insert creates partitions
k
A message from kapa.ai
I'm sorry, but the knowledge sources provided do not contain specific information about how BigQuery handles partitioned tables when using a simple
INSERT * FROM table_copy
statement, nor do they detail whether such an insert would create new partitions or affect existing ones in a way that could explain the behavior you observed. The documentation does mention that partitioning and clustering are important for performance and that you should align your cursor fields with partition columns for optimal incremental syncs, but it does not address the impact of manual inserts on partitioned tables or how this might interact with Airbyte-managed tables or sync modes. Therefore, I cannot provide a definitive answer to your question based on the available sources[BigQuery source sync modes](https://docs.airbyte.com/integrations/sources/bigquery#supported-sync-modes). If you need a precise answer regarding BigQuery's partitioning behavior with manual inserts, I recommend consulting BigQuery's official documentation or support.
n
@kapa.ai are airbyte logs in UTC time?
k
A message from kapa.ai
The knowledge sources do not explicitly state whether Airbyte logs are in UTC time. However, several log examples and documentation snippets show timestamps with a
+00:00
offset or explicitly mention UTC (for example, in the [airbyte-workload-launcher logs](https://github.com/airbytehq/airbyte/issues/59730)), which suggests that Airbyte logs are typically recorded in UTC time. Still, since there is no official statement in the documentation, I cannot confirm this with complete certainty.