Design a CDC pipeline that handles schema evolution gracefully

Tests designing resilient CDC pipelines against schema drift. A strong answer covers schema registries with versioning, backward-compatible serialization, and automated compatibility checks.
What's really being asked
This question tests whether you understand that CDC streams are living contracts that will inevitably drift, and whether you can design an analytics architecture that isolates upstream changes from downstream consumers. The interviewer cares about your ability to prevent silent data loss, corrupted joins, and broken dashboards when a source database adds columns, renames fields, or widens types. They want to see systems thinking around compatibility guarantees, not just point solutions.
The full answer
First, enforce a schema registry with versioning and compatibility rules. Use Confluent Schema Registry or AWS Glue Schema Registry to version Avro, Protobuf, or JSON schemas, setting policies like BACKWARD or FULL so producers cannot push breaking changes unnoticed. Second, choose serialization formats that natively support schema evolution. Avro and Parquet handle added nullable columns gracefully, while Delta Lake or Iceberg provide table-level schema evolution and time travel. Third, decouple ingestion from serving. Land CDC events into a raw bronze layer with flexible typing, then apply schema enforcement only when casting to structured silver tables; this absorbs drift without breaking historical data. Fourth, automate detection and CI/CD gating. Run compatibility checks in the deployment pipeline and alert on schema drift before changes reach production. Fifth, plan for rollback. Maintain a versioned contract so you can revert to a previous schema state if a change introduces corruption.
The mistakes people make
A major red flag is suggesting you pause the pipeline and manually run ALTER TABLE statements across all downstream databases. This creates downtime and does not scale past a few tables. Another mistake is ignoring type changes entirely, assuming string casting will always work; this leads to silent truncation or join failures. Hardcoding column indexes instead of names is also dangerous because CDC events may shift ordinals when columns are added. Finally, proposing to reject all schema changes by default shows inflexibility; modern platforms expect controlled evolution, not frozen schemas.
What usually comes next
The interviewer may ask how you would handle a dropped column without losing historical data, which tests your understanding of soft deletes or schema-on-read patterns. They might probe how to coordinate schema changes across microservices, looking for answers about contract testing and consumer-driven compatibility. Another follow-up is performance: how does a schema registry impact serialization throughput, or how do you backfill a new column added mid-stream?
A concrete example
Imagine an e-commerce CDC pipeline capturing orders from PostgreSQL. A product team adds a nullable discount_code column to the orders table. Because the pipeline uses the Confluent Schema Registry with BACKWARD compatibility, the new schema version is accepted. The raw Kafka topic ingests the new field without breaking existing consumers. A downstream Spark job reading Delta Lake tables automatically merges the new column into the bronze layer with NULL defaults for historical rows. The analytics team discovers the field the next day and updates their dbt models to expose it, while legacy dashboards remain unaffected because they select specific columns rather than using SELECT star.
Interview question
Which approach best prevents broken dashboards and silent data loss when a source database adds nullable columns in a CDC pipeline?
- a.Use a schema registry with compatibility checks, land raw events flexibly in a bronze layer, and enforce schemas only when casting to silver tablesCorrect
- b.Serialize events as schemaless JSON and rely on downstream consumers to handle type conversions dynamically
- c.Reject all schema changes by default and require explicit approval for every new field to prevent consumer breakage
- d.Pause the pipeline and run coordinated ALTER TABLE statements across all downstream databases before resuming ingestion
Why? this is the answer
Decoupling ingestion from serving lets the bronze layer absorb drift without breaking historical data, while registry compatibility rules catch breaking changes early. Pausing for coordinated ALTER TABLES creates downtime and does not scale, making it the most tempting but dangerous distractor.
Just read this? Test yourself on what you have been reading.
Read the original → branchboston.com
- #cdc
- #schema-evolution
- #data-engineering
- #analytics
- #pipeline-design
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles