Tech challenge · System Design

Reprocess two years of data after a bug

MediumSystem Design

A bug in a transformation produced wrong values in a daily partitioned table for the last two years. You must reprocess everything without breaking dashboards that read the table during the day. How do you plan the backfill?

Think it through or sketch an answer first, then open the hint or the solution.

Show a hint

Idempotent writes per partition, in controlled batches, isolated from the daily job.

Show the solution

Make the job write one date partition at a time with overwrite semantics (replace only that partition), so reruns are safe. Run the backfill in batches of days on separate compute so the daily job is not starved, newest data first if recent numbers matter most. Validate each batch (row counts, totals against the source), keep a log of completed dates so it can resume, and tell consumers what changes and when.

Common mistakes

  • Running two years in one job, so one failure restarts everything.
  • Appending corrected rows instead of replacing partitions, which doubles the data.

Learn more

More System Design challenges

Today's challenge and the full archive