Scrivio Interview library
ScenarioAdvanced6 min read · updated 13 November 2026

A bug in a fraud-feature stream job produced wrong features for 3 weeks before anyone noticed. Kafka keeps the input topic for 7 days, the fix is ready, and the fraud models need corrected features for the whole period.

How do you reprocess history the log no longer holds, while the live job keeps running, and what do you change so the next fix is easier?

We source the two weeks Kafka no longer holds from an archive, an object-storage copy of the topic made by a sink connector or tiered storage, or rebuild the inputs from the source databases if there is no archive. The corrected logic runs as a separate backfill job writing to a new versioned output such as features_v2, ideally from the same code base as the live job, then a corrected live job continues on v2, we compare overlapping periods and switch consumers. Next time is easier if every important topic is archived, retention covers the time it takes to detect bugs, and data-quality checks compare feature distributions every day.

Why this question is asked

Kappa architecture promises that fixing a bug means replaying the log. This scenario shows the fine print: the log only remembers seven days, and the bug lived for three weeks. Interviewers ask this to see whether we can plan a safe backfill while the live system keeps running, and whether we fix the process as well as the data. In this answer, we will lay out the numbers, find the missing history, run the backfill beside the live job, switch over safely, and then change retention, archiving and checks so the next fix is routine.

1The Situation in Numbers

The bug produced wrong features for 21 days. Kafka retains the input topic for 7 days, so 14 days of input are gone from Kafka. The fraud models need correct features for all 21 days, both to score current transactions and to retrain on clean data. The live job must keep running throughout, because fraud scoring cannot stop while we repair history.

So we have three problems: getting the 14 missing days from somewhere, recomputing 21 days with the fixed code without disturbing live scoring, and moving consumers from the wrong features to the right ones in one controlled step.

2Finding the Missing Two Weeks

The first place to look is an archive. Many teams already copy important topics to object storage, either with a Kafka Connect sink connector writing hourly files to S3 in a format like Parquet or Avro, or through Kafka's tiered storage, which moves older log segments to object storage while keeping them readable through Kafka (it is production-ready in recent Kafka versions; check yours). With tiered storage the old data may simply still be readable from the topic.

If no archive exists, we rebuild the inputs from their sources. The order and payment events behind fraud features usually come from databases that keep the history: we query those 14 days and turn the rows into events in the same shape as the topic, ordered by event time. This is slower and must be checked carefully, because the rebuilt events may differ slightly from what the stream carried, for example in timestamps or fields that were not stored.

3Running the Backfill Beside the Live Job

The corrected logic runs as a separate backfill job. It reads the archive for the oldest days and then the 7 days still in Kafka, and writes to a new, versioned output, features_v2, never into features_v1 that live scoring reads. Writing into the live output would mix fixed and broken values while the job runs, and a mistake in the backfill would hit production immediately.

Ideally the backfill is not new code but the same job, with the fix, started with a bounded input. This is the kappa idea done properly. Flink, for example, can read files with a bounded source, and its hybrid source reads files first and then continues from Kafka, so one job can backfill and then become the live job. Because features are computed by event time, replaying old events produces the same windows as if they had arrived live. One code base means the backfilled features and the live features are computed the same way, which is the property the models actually need.

Step throughBackfill and live jobs side by side
  1. features_v1written by the current live job; still read by fraud scoring
  2. features_v2written by the corrected job; read by nobody until verified
  3. Corrected job (same code base)reads archive files, then continues from Kafka
  4. Inputsobject-storage archive for days 1-14, Kafka for days 15-21 and live

4 layers, from the top down. Step through them one at a time.

The corrected output is built in isolation; consumers move only after it is verified.

4Switching Over Safely

When the backfill reaches the present, the corrected job keeps running live on features_v2, so for a while both versions are produced. We use that overlap to verify: on the days after the fix, v2 should differ from v1 exactly where the bug applied and agree elsewhere, and feature distributions in v2 should look like the period before the bug started.

Step throughFrom backfill to switch-over
  1. Backfill days 1-21 into features_v2archive first, then Kafka
  2. Run corrected job live on features_v2both versions now produced
  3. Do v1 and v2 differ only where the bug applied?
    YesSwitch consumers to v2NoInvestigate before switching
  4. Retrain models on corrected historyusing v2 for the whole period
  5. Retire the v1 job and outputafter an observation period

5 steps in order. Play them, or step through them one at a time.

Only then do consumers switch, ideally through configuration or a view that points at the current version, so the switch and a rollback are each a single change. After a safe period, the old live job and features_v1 are retired.

5Making the Next Fix Easier

The real lesson is that our retention was shorter than our detection time. We found the bug after 21 days and only had 7 days of history. Three changes fix that. First, archive every important topic to object storage, with a sink connector or tiered storage; storage is cheap compared with rebuilding history by hand. Second, keep retention, in Kafka or in the archive, comfortably longer than the time it takes to notice a problem. Third, shorten that detection time with data-quality checks that compare feature distributions day by day, such as mean, null rate and percentiles per feature, and alert when a feature shifts sharply. A bug that changes a feature's distribution should be caught in a day, not three weeks.

6Follow-up questions

How do you prevent the backfill job from starving the live job of cluster resources?

I would run the backfill on separate capacity: its own cluster or a separate resource pool with a fixed quota, so it cannot take slots from the live job. Reads from Kafka can be limited with client quotas so the brokers keep serving the live consumers, and archive reads go to object storage, which does not compete with Kafka at all. The backfill also runs with a lower priority and can be paused if live latency rises, because finishing a few hours later costs much less than slowing fraud scoring.

Why not overwrite features_v1 in place?

Because during the backfill v1 would contain a mix of fixed and broken values, the models would read inconsistent data, and if the fix itself had a bug we would have no clean way back. A separate versioned output makes the change verifiable and reversible.

What if the rebuilt events from databases differ from the original stream?

Then the backfilled features may differ slightly from what a perfect replay would give. We measure it on the 7 days that exist in both forms, compare features computed from Kafka with features computed from the rebuilt events, and accept the backfill only if the differences are within an agreed tolerance.

7Conclusion

In this answer, we saw how to reprocess history the log no longer holds: take the missing days from an object-storage archive or tiered storage, or rebuild them from source databases, run the corrected logic as a separate job from the same code base into a versioned output, verify on overlapping days, and switch consumers in one step. Then we make the next fix routine by archiving important topics, keeping retention longer than detection time, and adding daily distribution checks.

What to say in the interviewAbout 90 seconds aloud

Open with

Kafka only has the last 7 days, so the first job is finding the other 14. If we archive the topic to object storage with a sink connector or use tiered storage, I read those days from there; if not, I rebuild the input events from the source databases, in the same shape and ordered by event time, and validate them against the 7 days we still have in Kafka.

Then, if they want more

Then I run the corrected logic as a separate backfill job writing to a new versioned output, features_v2, never into the live output.

I would want it to be the same code base as the live job, just started with bounded archive input, for example with Flink reading files and then continuing from Kafka, so backfill and live compute features identically.

Once it catches up, the corrected job runs live on v2 beside the old one, we compare the overlapping days, make sure the differences are exactly where the bug was, then switch consumers through configuration and retrain the models on clean history. The backfill runs on separate capacity so live scoring is not starved.

Afterwards, I would archive every important topic, keep retention longer than our detection time, and add daily checks on feature distributions so a bug like this is caught in a day, not three weeks.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "How do you reprocess history the log no longer holds, while the live job keeps running...": https://scrivio-interview-library.netlify.app/architecture/storage-and-pipelines/d626e183c9/