Backfill Lab
The revenue model has excluded refunds incorrectly for six months. Fixing the code fixes tomorrow — six months of published history is still wrong, and repairing it is a write into production data that a great many teams get wrong in the same way.
Ranges, partition counts and validation outcomes below are produced by the pipeline model in this repository. They exist to make the sequence concrete, not to tell you how long a real backfill takes — which depends on your data, your engine and how much of it you can afford to recompute at once.
The revenue model has excluded refunds incorrectly for six months.
The lab
Choose the range, recompute, validate and publish. Then check what happened to the partition that was already correct.
| Property | Append | Merge on key | Replace partition |
|---|---|---|---|
| Idempotent | no | yes | yes |
| Needs a unique key | No | Yes — and a key that is nearly unique is worse than none, because it merges rows that were different. | No, but it needs the partition boundary to match the backfill range exactly. |
| Readers during the run | See a growing, double-counted table. | See consistent rows if the merge is atomic; a table format decides whether it is. | See an empty partition between the delete and the write, unless the format supports an atomic swap. |
| Cost | Cheapest write, most expensive mistake. | Rewrites matched files; more work than an append. | Rewrites the whole partition even for one changed row. |
The sequence
Eight steps, and the order is the argument. Each one exists to prevent a specific way the previous one goes wrong.
- Why this step, in this positionIt stops the bug producing new wrong history while you deal with the old, and it gives you a period computed by the new logic to validate the backfill against.
The way this goes wrong
A real backfill, run without that sequence. Read the symptom and decide what you would do before opening the trap.
The six-month revenue backfill runs against production during business hours.