<@U04S8PLJWMT> I am getting this error with MSSQL ...
# replication-ask-ai
l
@kapa.ai I am getting this error with MSSQL CDC after resetting the connection:
Copy code
io.airbyte.cdk.TransientErrorException: Triggering reset. Incumbent CDC state is invalid, reason: Saved offset no longer present on the server. Automatically resetting to current position. WARNING: Any changes between the saved position and current position will be lost. Saved LSN '00053930:00021aa0:0008' is no longer available in SQL Server transaction logs..
k
MSSQL CDC "Saved offset no longer present on the server" Error This error means the LSN (Log Sequence Number) saved in your CDC state has been recycled by SQL Server before the next sync could use it. There are a few known causes and fixes: Root Causes 1. CDC retention too short — The SQL Server CDC cleanup job is removing old change data before your next sync runs. 2. Static/low-activity tables — If your tables have little or no changes, Debezium may not advance the saved
commit_lsn
, causing it to eventually age out. [Static Tables Issue] 3. LSN validation regression (v4.3.4+) — A change in v4.3.4 introduced stricter LSN range checking that can cause false negatives, especially on Azure SQL geo-replicas or databases with aggressive log truncation. [LSN Regression Issue] 4. Insufficient permissions — If the Airbyte user lacks access to some CDC capture instances,
fn_cdc_get_min_lsn
returns a zero LSN, which is treated as invalid. [CDC Offset Fix PR] Recommended Fixes 1. Extend CDC retention period Run this on your SQL Server to increase the CDC cleanup job retention (recommended: at least 10 days):
Copy code
-- Set retention to 14400 minutes (10 days)
EXEC sp_cdc_change_job @job_type='cleanup', @retention = 14400;
[MSSQL Docs] 2. Check connector version • If you're on v4.3.4, consider upgrading to v4.4.3+, which includes fixes for: ◦ False-negative LSN validation due to permission issues (NULLIF fix) [CDC Offset Fix PR] ◦ Idle CDC state refresh for static tables [Idle State Fix PR] 3. Verify Airbyte user permissions Ensure the Airbyte database user can access CDC change tables:
Copy code
SELECT * FROM cdc.change_tables;
If this returns no rows or errors, the user may need additional permissions. The recommended role is
db_owner
, though
db_datareader
+
cdc_user
may work in some cases. [LSN Regression Issue] 4. Increase sync frequency Sync more frequently so the saved LSN doesn't age out between runs. If You're on Azure SQL Geo-Replicas This is a known issue where Azure aggressively recycles transaction logs (
log_reuse_wait_desc = NOTHING
), causing LSNs to expire within seconds. The workaround confirmed to work is downgrading to v4.3.3, though upgrading to v4.4.3+ with the permission/validation fixes is the proper long-term solution. [LSN Regression Issue] > Note: The "Re-sync data" invalid CDC position behavior can cause an infinite retry loop in this scenario, since each new LSN also expires quickly. Using "Fail sync" and investigating the root cause is recommended for production environments. [CDC Best Practices] 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.