Lesson 8 of 10 Data Pipeline Design Patterns

Running Backfills Safely

This lesson explains how to reprocess history after a bug fix, a change in business logic, a new column or a new source, producing correct results for past periods without disrupting current runs.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify the prerequisites for a backfill.
  • Run backfills with each orchestrator.
  • Protect consumers from half-finished backfills.

Prerequisites

A backfill reprocesses historical data, for example after a bug fix or the addition of a new column, and it must not corrupt existing results. It is possible only if raw data has been kept unchanged in the landing zone, so that history can always be reprocessed from the original input.

Jobs must be parameterised by logical date, such as Airflow's data interval or a date passed as Step Functions input, not by "today", so that a job can be run for any past date. Each run must be idempotent, so the backfill overwrites partitions cleanly. And backfills run with limited concurrency, so that they do not take the capacity that current daily runs need.

Select all that apply

Ready to backfill?

Exam skills 1.1.11 · 1.3.2

Identify what must be true before a safe backfill.

Log in to try this activity Interactive activities are free with an account.

Running backfills

A backfill runs a pipeline for past periods, for example after fixing a bug or adding a new column, and each orchestrator supports it differently. In Amazon MWAA, the airflow dags backfill command runs a DAG for a date range, the catchup setting runs missed intervals automatically, and max_active_runs limits how many run at once so the backfill does not overwhelm sources or targets. In Step Functions, a Distributed Map iterates over a list of dates with a maximum concurrency. In Glue, job runs take the date as an argument, and job bookmarks are reset or paused so that already-processed data is read again. The following table summarises the features.

OrchestratorBackfill features
Amazon MWAA (Airflow)airflow dags backfill for a date range; catchup; max_active_runs to limit concurrency
Step FunctionsDistributed Map over a list of dates with a maximum concurrency
GlueJob runs with date arguments; job bookmarks reset or paused for reprocessing

The following diagram shows the backfill in progress beside the daily schedule.

The six-month backfill. Because raw data is kept and the job is parameterised by date and overwrites one day's partition, an Airflow backfill reprocesses the six months with at most four runs at a time, while the daily schedule keeps running alongside it.
The progress shown is illustrative.
Match the pairs

Backfill features

Exam skills 3.1.1

Match each backfill need with the orchestrator feature.

Log in to try this activity Interactive activities are free with an account.

Protecting consumers

Consumers should not see half-finished backfills. Writing backfilled data to a new table or Iceberg branch and switching once it is complete, or overwriting partitions one at a time with atomic commits, keeps every query consistent. Large backfills also need capacity planning, for example a separate Redshift workgroup or limits on Glue concurrency.

Scenario questions

Hiding a half-finished backfill

Exam skills 2.1.7 · 1.3.2

Choose how to keep consumers safe during a backfill.

Log in to try this activity Interactive activities are free with an account.
Worked example

A bug in a currency conversion affected six months of curated sales. The fix is deployed, and the team must correct history without delaying today's pipeline.

Because raw data is kept and the job is parameterised by date and writes idempotently, the team runs an Airflow backfill for the six months with max_active_runs set to four. Each run overwrites one day's partition, and the daily schedule continues alongside it.

Check yourself

Why limit concurrency during a backfill?

Show answer

Running many periods at once can overload sources, targets and quotas; a limit such as Airflow's max_active_runs keeps the load safe.

Exam Tips

Remember for the exam

  • Backfills need immutable raw data, jobs parameterised by logical date, and limited concurrency.
  • Use Airflow backfill with max_active_runs, or Distributed Map with a concurrency limit.
  • Idempotent writes let backfills overwrite partitions cleanly.
  • Publish backfilled data atomically so consumers never see partial results.
  • Never parameterise jobs by the current date.