Skip to content
About
Main content

Schema change propagation

How do schema changes travel in the stream, and which ones have no clean solution?

is a change in the shape of all later changes, and it arrives in the same stream as the data it reshapes. So it must be ordered against the data: events before the DDL follow the old shape, events after follow the new shape. This means a schema is a versioned, in-band fact, not a static configuration file.

This is why systems keep a schema registry (a service that stores each schema version and gives it an id) and attach a fingerprint (a short id of the schema version) to every event. The reader must resolve each record against the writer's schema as of that record.

Which changes old readers survive is the question of compatibility: adding a nullable column passes, dropping or narrowing a column does not. So pipelines survive additive evolution automatically, and require a coordinated migration for anything else. And the source's DBA, who owns neither your pipeline nor your calendar, decides which happens.

Two cases with no clean solution

  1. A type change in the middle of the stream. The same column now has two types inside one , and no single sink schema is correct for both. (This is Lena's integer-to-decimal change.)
  2. A DDL that rewrites the table physically. It may produce nothing in the log (a metadata-only operation you never see), or it may rewrite every row, producing an update storm of the whole table that cannot be told apart from real activity.
ALTER TABLE orders ADD COLUMN note text;                 -- metadata only: usually nothing in the log
ALTER TABLE orders ALTER COLUMN total TYPE numeric(12,2); -- may rewrite every row: a storm of 300M events

Both are correct behavior of the source. Both are catastrophic for you. This is the private-detail-becomes-public-interface principle again: you are consuming an interface that nobody promised to hold still.

In one line: schema is an in-band, ordered event; on both sides.