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:ย 

Best practices for processing HVR CDC data in Databricks when handling out-of-order updates, delete

krishgarikipati
Databricks Partner

Hi Databricks Community,

I am working on a data lakehouse architecture on AWS, where HVR captures changes from OLTP databases such as Oracle and PostgreSQL, AWS S3 is used for storage, and Databricks handles data processing across Bronze, Silver, and Gold layers.

We need to maintain accurate downstream Delta tables while processing inserts, updates, and deletes from source systems.

I would like to understand the recommended architectural approach for the following scenarios:

  1. Out-of-order events: If multiple updates for the same primary key arrive out of order, how can we ensure that an older event does not overwrite the latest record?

  2. Duplicate events and retries: How should we handle duplicate CDC records or replayed files without creating inconsistent target data?

  3. Delete propagation: What is the recommended approach to propagate source deletes from Bronze to Silver and Gold while retaining audit history where required?

  4. Incremental processing: Would you recommend implementing custom Delta MERGE logic or using Lakeflow Declarative Pipelines AUTO CDC APIs for this type of architecture?

  5. Performance: What are the best practices for handling high-volume CDC data, small files, and frequent MERGE operations on Delta tables stored in S3?

Our current architecture uses HVR for source ingestion and Databricks for downstream processing. I am particularly interested in a production-ready solution that balances data correctness, performance, maintainability, and cost.

If anyone has implemented a similar architecture, I would appreciate suggestions, design patterns, or code examples.

Thank you!

1 REPLY 1

emm022stone
Visitor

Hello, Use a source sequence number or commit timestamp to ensure only the latest change per primary key is applied. Deduplicate CDC records before merging, handle deletes with soft-delete flags or Delta Change Data Feed for audit requirements, and consider Lakeflow AUTO CDC for maintaining SCD Type 1 or Type 2 tables.