Discover

· 7 min read

Data Backfills: Rerun Without Missing or Duplicate Data

A safe backfill reruns a bounded range with idempotent writes and matching pipeline state, so recovery creates neither gaps nor duplicate rows.

Summarize withClaudeChatGPT

A pipeline can finish green after its paginator stops early, even though part of the expected range never arrived. The same uncertainty follows a partial failure, faulty logic, a new column, a source outage, or a late correction. Retries and a rerun button alone do not make a recovery strategy. Safe ETL recovery instead depends on knowing what reached the destination and what state committed.

What is a data backfill?

A data backfill reloads an explicit past range into a pipeline’s destination after data was missed, changed, or must be rebuilt. This boundary separates the backfill from an ordinary scheduled run.

Apache Airflow, a workflow scheduling platform, makes the boundary explicit in its backfill controls. Its backfills use start and end dates, define how existing runs affect reprocessing, and have a separate concurrency limit. Airflow creates additional runs for the selected logical dates, while scheduled work can use the remaining capacity.

What makes rerunning a failed load safe?

Rerunning a failed load is safe when the pipeline limits work to a known past range, writes repeated records to one intended result, restores state to match committed data, and checks freshness or expected volume separately from run status. A retry alone does not establish any of those conditions.

Recovery has five connected stages:

  1. Establish which destination writes completed.
  2. Correct the failure that stopped or corrupted the load.
  3. Continue from confirmed progress or select the affected historical range.
  4. Use writes that make overlapping input converge on one result.
  5. Verify that the expected data arrived.

Progress and processed data must describe the same point. Apache Flink, a stateful stream-processing framework, uses checkpoint snapshots that pair source positions with processing state. After a failure, Flink restores both through its latest completed checkpoint. Idempotent writes make overlap safe, but they do not prove that the source position or destination is complete.

When does a pipeline need a backfill?

A pipeline needs a backfill when past data is missing, incorrect, late, or absent from a new destination structure. Each cause identifies a past range that needs another pass:

  • Partial failure or outage: The missing interval did not reach the destination.
  • Extraction or transformation bug: Corrected logic must process records handled by the faulty version.
  • New column or table: The new structure needs historical values, not only future records.
  • Late correction: Updated source records arrived after their normal processing window.

The selected range can cover a time interval, a set of affected records, or the history needed for a new structure. Before that range runs again, recovery must account for what the failed load left behind.

What can a failed load leave behind?

A failed load can leave partial destination writes, progress beyond missing data, or an interrupted schema change. A failed run is not necessarily a clean slate because some destination writes can commit before another job fails. A rollback guarantee covers only its documented transaction boundary, not separately committed jobs.

The failure can also leave the cursor beyond data that never landed or interrupt a schema change partway through the load. Source position and processing state must return to the same confirmed point. Schema compatibility must be restored before the affected range runs again.

What remainsWhat recovery establishesEvidence needed
Partial destination writesWhich writes committedDestination rows and job status
Cursor beyond missing dataLast confirmed progress pointCursor or completed checkpoint
Interrupted schema changeCompatible destination structureApplied schema and failed operation

Once the remaining data and state are known, the destination write pattern determines whether overlap creates duplicates.

What makes a data pipeline idempotent?

An idempotent data pipeline gives the same intended destination effect when it processes the same bounded input again. This property concerns the result, not whether each execution performs identical internal work.

A primary key supports a merge that updates or replaces the matching destination record. Overwriting the affected partition replaces that partition. Neither operation controls where extraction resumes, so the source position and pipeline state remain separate parts of recovery. Flink makes the same separation in its end-to-end model, which requires replayable sources and transactional or idempotent sinks.

Overlap is safe only after the operation preserves one intended effect.

When does a retry help?

Retries fit transient failures, not deterministic ones. A timeout or temporary service fault can clear on another attempt. Bad credentials and malformed input require a change before the same request can succeed. An incompatible schema also requires intervention before the affected load can continue.

An AWS Builders Library article explains how timeouts bound waiting, backoff spaces attempts, and jitter separates synchronized retries. Retries at multiple layers can multiply demand on a failing dependency. Limiting retry attempts at one appropriate layer reduces that risk, while idempotent side effects make repetition safe.

A retry repeats an attempt. It does not establish what committed, restore mismatched state, or select the range that must run again.

Why can a green run still hide missing data?

Run status and data arrival are separate signals. A paginator can stop early without raising an error, so the process finishes while part of the expected range remains absent. Logs and successful task status show what the process reported, not whether the full range arrived.

Freshness shows whether expected data arrived on time, but it does not prove that each expected record arrived. A row count becomes evidence of missing data only when it is compared with an expected volume. A failure or freshness breach therefore needs a visible signal that reaches the pipeline owner with its reason.

SignalQuestion answeredLimit
Run statusDid the process report success?Cannot prove completeness
FreshnessDid data arrive on time?Cannot prove record count
Expected volumeDid the expected amount arrive?Needs a defined expectation
Failure alertWho knows what failed?Needs diagnostic context

Who owns ETL recovery?

ETL recovery belongs to the team that owns the ingestion pipeline and happens at the point of entry. That team has the source context, extraction state, destination behavior, and failure evidence needed to repair the load. A downstream patch can hide the result without correcting the pipeline that will process the next occurrence.

Checks that need history remain connected to the pipeline and load that produced the data. Their failures can then identify the affected range instead of creating a separate cleanup process. Regulated recovery also includes recovery testing. The Digital Operational Resilience Act (DORA), Regulation (EU) 2022/2554, covers that adjacent requirement; DORA compliance for data teams explains it.

How does dltHub rerun a failed range?

dltHub reruns a failed range by running the team’s dlt pipeline code with explicit bounds, pipeline state, idempotent writes, and visible signals. The incremental cursor in dlt accepts initial_value and end_value. When the upper bound is present, the backfill does not modify the existing incremental state.

updated_at=dlt.sources.incremental("updated_at", initial_value="1970-01-01T00:00:00Z", end_value="2022-07-01T00:00:00Z")

State must also stop at the last completed load. The production controls add a load ID to _dlt_loads only after its package completes. Until then, destination state stays at the package-creation point, so its cursor does not advance past unloaded data. Some jobs can still write destination data before the package fails, so the owner inspects those writes before choosing a recovery action.

Idempotent writes complete the destination side of the recovery. A merge operation can use a primary key or merge key, with the default delete-insert operation covering root and nested tables in one transaction. The destination_scope feature replaces rows selected by a destination condition. dltHub pipeline observability shows run status, logs, failure details, rows, bytes, and duration. Failure alerts can reach Slack or email with the error and links to the run and logs. Freshness breaches and recoveries can also reach Slack or email with diagnostic context.

Recovery behaviorEvidenceWhat remains
Backfill rangeExplicit cursor boundsRange is selected by the owner
Pipeline stateLoad ID after package completionPartial writes still need inspection
Merge by keyDelete-insert transactionKey choice controls matching
SQL conditionSelected rows replacedNeeds a destination condition
Transient failureRetried during the loadAttempts remain bounded
Terminal failurePending under default settingsOther settings can fail or abort
Visible failureRun details and alertsVolume expectations remain separate

Book a call to try dltHub with an explicit backfill range and the recovery behavior shown here.

Was this page helpful?