cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

guidance on cleainig up after long cdc failure

turagittech
Contributor

Hi All,

We had a CDC failure which took far to long to resolve. A conversation with vendors on that.
Does anyone have any guidance on the process steps to identifying the missed changes and applying them to the tables.

I have so far run a query to identify keys in end tables where there are variations in data (left join)

It is suggesting some tables are okay and some have work to do rows with changes where source doesn't match the destination tables

A merge to update seems the next logical step.

Anything else people would like to throw in 
Do I pause the ingestion and gateways while doing this? 
A full refresh needed to be done on fixing the issue with the pipelines

Any further advice?

2 REPLIES 2

K_Anudeep
Databricks Employee
Databricks Employee

Hello @turagittech !,

Your approach of comparing the source and destination tables to identify discrepancies is a good starting point. A MERGE would be a reasonable next step to correct the mismatched records.

A few recommendations before proceeding:

  1. Confirm the time window during which CDC changes were missed. This will help validate whether the discrepancies are related to the reported failure.

  2. Along with identifying inserts and updates, make sure to check for records that were deleted from the source but still exist in the destination. A left join from source to destination alone may not capture these.

  3. I would recommend temporarily pausing ingestion for the affected tables while performing the corrective MERGE operations. This helps avoid concurrent updates and potential conflicts between the manual corrections and incoming CDC changes. If pausing is not feasible, ensure that the merge logic prevents older records from overwriting newer changes.

  4.  Before making any changes, consider creating a Delta table clone or preserving a known table version as a recovery point.

  5. Test the merge logic on a smaller dataset first and ensure it handles inserts, updates, and deletes correctly. If the source provides a reliable timestamp or sequence number, use it to prevent older changes from overwriting newer data.

  6.  Once the corrections are applied, rerun the source-to-destination comparison to confirm that all identified discrepancies have been resolved, including missing deletes.

  7. Regarding the full refresh, it may not be necessary solely to correct missed CDC records. However, if the pipeline state or checkpoint was impacted by the failure, a full refresh might be required depending on the CDC connector's recovery capabilities. Since you mentioned that a full refresh has already been performed, I would first validate the consistency between the current source and destination before initiating another refresh.

Additionally, I would suggest checking whether your CDC vendor supports a table-level resync or backfill operation, as this may be preferable to manually correcting the records.

In short, my recommendation is to pause ingestion for the affected tables, reconcile differences, apply necessary corrections, validate the results, and then resume ingestion from a verified CDC position.

Anudeep

Jen_Evangelista
New Contributor II

Hi, @turagittech ,

Your source-to-target comparison is a good starting point. Check missing inserts, changed values, and records deleted from the source separately. A source-to-target left join alone can miss deletes.

Since you mentioned a full refresh, first validate the resulting tables before applying another repair.

For the affected tables, coordinate a controlled pause of destination writes during reconciliation, following the connector's recovery procedure. Whether the gateway should also be paused depends on the connector and source log retention.

Before manually modifying pipeline-managed tables, check whether the connector supports a table-level resync. If a corrective MERGE is appropriate, ensure older snapshot data cannot overwrite newer CDC events.

Which CDC connector are you using, and did the full refresh complete successfully for all affected tables?