Skip to content
Tech Interview Prep
Technical interview guide

Schema Evolution & Versioning

Changing a shared schema without breaking every downstream consumer that depends on it.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed
Relevant for
Data Architect

Scope: Apache Avro and Iceberg current specifications, Protobuf edition 2024 guidance, Confluent Schema Registry current compatibility modes, Delta Lake protocol, PostgreSQL 18, JSON Schema 2020-12, OpenAPI 3.1.1, and Parquet logical types current 2026-08-31.

Overview

Curated: · Written: · Reviewed:

Schema Evolution & Versioning

In one line

Change a shared schema so every producer, stored record and consumer that depends on it keeps decoding correctly. Pick a compatibility direction and a deployment order that make that true. Reach for it whenever a record, topic, table or API outlives a single deploy.

Key definitions

  • Backward compatible: a new reader decodes old data. Upgrade consumers first.
  • Forward compatible: an old reader decodes new data. Upgrade producers first.
  • Full: both directions hold.
  • Writer schema vs reader schema: Avro resolves the schema the data was written with against the schema the reader asks for. Fields match by name or alias, reader defaults fill gaps, and writer-only fields are skipped.
  • Field identity: Protobuf tag numbers and Iceberg field IDs identify fields. Names do not.
  • Expand-migrate-contract: add the new representation beside the old, dual-write and backfill, then remove the old one after telemetry confirms no readers need it and the rollback window has passed.

How it works

  1. The producer serializes with a schema ID. The registry checks the new version against the subject's policy and returns HTTP 409 on failure.
  2. An Avro reader matches each reader field to the writer schema by name or alias. A missing field with a default takes the default. A missing field without one fails the read.
  3. Protobuf matches fields by tag number on the wire. JSON mappings use field names, so a rename changes the JSON key and the generated API while the bytes stay valid.
  4. Iceberg and Delta map columns by field ID or column mapping, not by name, so a rename keeps the data readable.
rejected accepted Producer writes v5 Registry compatibility check Add default or stage the change Topic: Avro bytes plus schema ID Consumer with reader v4 Resolve: skip writer-only fields

When to use and when not to

SituationChoiceWhy
Public stream, unknown consumersBACKWARD_TRANSITIVE; breaking change moves to a new topic versionEvery retained version must still decode
Internal stream, co-deployed consumersBACKWARD against versions still in the replay windowThe check matches what is actually alive
Owned Iceberg or Delta tableAdditive change under the engine's rulesField IDs keep renames safe
Meaning, unit or grain changesNew field or new version, even if the type is unchangedThe registry cannot see meaning
Old readers need a removed fieldDo not remove; deprecate and expand-contractRemoval breaks readers you cannot see
FULL_TRANSITIVE on a high-churn subjectAvoidTeams end up disabling the check, which is worse

Traps interviewers probe

  1. Adding a field without a default under BACKWARD. The registry rejects it because an old record has nothing to fill the field. Fix: add a truthful default. A nullable union alone is not a default.
  2. Treating registry acceptance as runtime safety. FORWARD accepts an added field with no default, but v2 readers then fail on v1 records. Fix: deploy in the order the direction requires, and replay historical records through the new reader.
  3. Renaming an Avro field without an alias. The reader substitutes the default and no error is raised. Fix: add the alias on the reader field, or use expand-contract.
  4. Reusing a deleted Protobuf tag. Old and new int32 fields share a wire type, so the value is decoded into the wrong field without error. Fix: reserve the tag number and name.
  5. Passing structural checks with a semantic change. Milliseconds becoming seconds passes every type check and corrupts decisions. Fix: encode the unit in the field name and add a contract test against the product's valid range.

Interview tips

Open with the direction, the format and the consumers you verified: "Backward against the retained versions in Avro, with the readers deployed first." Then state whether the change is additive.

Expect these follow-ups:

  • Who may disable a compatibility check, and what does the audit trail show?
  • How do you know it is safe? Old writer with new reader, new writer with old reader, oldest stored data replayed, and the registry outage case.
  • How long can you roll back? For tables, the window is bounded by snapshot retention, because old snapshots and time-travel queries still read the old schema.
  • What happens to records written several versions ago? They must still decode under the current reader.

30-second outline:

  1. Name the format and the direction.
  2. State the change and whether it is additive, with its default.
  3. Give the deployment order that makes the direction true.
  4. Name the test: historical fixtures through the real client versions.
  5. Name the semantic check and the rollback path.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.