Quick revision
The short answer
While the group was down for 10 hours, retention, set to 8 hours, deleted the segments holding its committed offsets, so on restart the committed position was below the log start offset and out of range. With auto.offset.reset=latest, the consumer jumped to the end of the log, skipping the 8 hours still on disk as well as the 2 hours retention had already deleted, and the client only logged an INFO line, so lag dropped to zero with no error. With earliest it would have read the remaining 8 hours. Prevent it by alerting on time lag against retention, keeping retention longer than the worst recovery time and using none for critical consumers; repair the gap from the source or a lake copy.
What to remember
In this answer, we reconstructed the incident. Retention of 8 hours deleted the data at the group's committed offsets during its 10-hour outage, so on restart the offsets were out of range and auto.offset.reset applied. With latest, the consumer jumped to the end, skipping the 8 retained hours as well as the 2 deleted ones, and only logged an INFO line while lag fell to zero. earliest would have lost only 2 hours. Time-lag alerts against retention, longer retention and none for critical consumers prevent it, and the gap is repaired from the source or a lake copy.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
While the group was down for 10 hours, retention, set to 8 hours, deleted the segments holding its committed offsets, so on restart the committed position was below the log start offset and out of range. With auto.offset.reset=latest, the consumer jumped to the end of the log, skipping the 8 hours still on disk as well as the 2 hours retention had already deleted, and the client only logged an INFO line, so lag dropped to zero with no error. With earliest it would have read the remaining 8 hours. Prevent it by alerting on time lag against retention, keeping retention longer than the worst recovery time and using none for critical consumers; repair the gap from the source or a lake copy.
Why this question is asked
'Lag went to zero instantly' sounds like a happy ending to an incident, which is exactly why this failure is so dangerous. Interviewers use it to see whether we can reconstruct what the consumer did from the evidence, and whether we know that the default reset policy can throw away data that is still on disk. In this answer, we will recap offsets and retention, build the timeline, trace the consumer's decision on restart, compare what earliest would have done, and then cover prevention and repair.
1A Quick Recap of Offsets and Retention
A consumer group stores, for each partition, the committed offset: the next record it should read. A topic's retention, here 8 hours, deletes log segments whose records are older than that, so the oldest offset still on disk, the log start offset, keeps moving forward. A committed offset is only useful while it is at or above the log start offset.
auto.offset.reset tells the consumer what to do when it has no usable committed offset: earliest starts at the log start offset, latest at the log end offset, and none throws an exception.
2Building the Timeline
Let the group stop at 00:00, having committed offsets pointing at records written just before 00:00. It comes back at 10:00. With 8 hours of retention, at 10:00 the log holds roughly the records from 02:00 to 10:00; everything from 00:00 to 02:00 has been deleted. The committed offsets point at 00:00, two hours before the oldest record still on disk.
| Time written | State at 10:00 | Read with latest | Read with earliest |
|---|---|---|---|
| before 00:00 | processed before the outage | - | - |
| 00:00 to 02:00 | deleted by 8-hour retention | lost | lost |
| 02:00 to 10:00 | still on disk | skipped | read |
| after 10:00 | new records | read | read |
3What the Consumer Did on Restart
On assignment, the consumer fetched its committed offset and tried to read from there. The broker answered that the offset was out of range, since it was below the log start offset. That is one of the two cases where auto.offset.reset applies. The policy was latest, so the consumer reset its position to the log end offset, the next record to be written, and continued from there.
From the outside, everything looked healthy. Lag is the difference between the log end offset and the consumer's position, and the position had just been set to the log end, so lag dropped to zero at once. No exception was thrown, because resetting is exactly what the policy asks for. The only trace is an INFO log line from the client saying it is resetting the offset for each partition, easy to miss among startup logs.
Notice the cruel detail: the 8 hours still on disk, from 02:00 to 10:00, were perfectly readable, yet latest skipped them too. The reset policy does not try to get as close as possible to the old offset; it jumps to whichever end it is told.
4What earliest Would Have Done
With earliest, the consumer would have reset to the log start offset, the first record from about 02:00, and read the 8 retained hours. Downstream would have been missing only the 2 hours retention had already deleted. Lag would have been large and visible, and the catch-up would have taken a while, which is the honest picture of what happened. So the choice of policy turned a 2-hour gap into a 10-hour gap, and turned a visible problem into a silent one.
5Preventing It
First, alert on time lag, the age of the oldest unconsumed record, not only on record lag. A group that is down shows rapidly growing time lag, and an alert when time lag reaches, say, half of retention gives the team hours to act before data is deleted. A group with no active members at all should alert too.
Second, keep retention longer than the worst realistic recovery time. 8 hours is shorter than an overnight outage with a slow escalation; 3 to 7 days is common for important topics, and tiered storage makes long retention cheaper.
Third, for critical consumers, set auto.offset.reset=none and handle the exception explicitly: alert, and let an operator decide whether to start at the earliest available offset, a specific time, or not at all. That turns a silent jump into a stop that someone must look at.
- Time lag above half of retention?YesPage the owning teamNoNormal
- Group restarts with committed offset out of range
- auto.offset.reset=none?YesException, alert, operator chooses startNoSilent jump to earliest or latest
3 steps in order. Play them, or step through them one at a time.
6Repairing the Gap
Kafka no longer holds the first 2 hours, and the consumer's group has moved past the other 8, so the repair has two parts. The 8 hours still on disk, if retention has not removed them yet, can be replayed at once in a separate consumer group seeking to 02:00, with idempotent processing. The 2 deleted hours have to come from outside Kafka: the source system that produced the events, or a lake copy written by a sink connector. The faster we act, the more we can recover from Kafka itself, because retention keeps deleting while we investigate.
7Follow-up questions
Would the group's offsets themselves have expired?
Not here. An empty group's committed offsets are kept for offsets.retention.minutes, 7 days by default, so after 10 hours they still existed. The problem was not missing offsets but offsets pointing at deleted data.
Why does latest jump past data that is still available?
Because the policy is simple by design: it chooses one of two ends of the log and has no notion of 'nearest'. Only the application knows whether skipping is acceptable, which is why none exists for consumers that must decide for themselves.
8Conclusion
In this answer, we reconstructed the incident. Retention of 8 hours deleted the data at the group's committed offsets during its 10-hour outage, so on restart the offsets were out of range and auto.offset.reset applied. With latest, the consumer jumped to the end, skipping the 8 retained hours as well as the 2 deleted ones, and only logged an INFO line while lag fell to zero. earliest would have lost only 2 hours. Time-lag alerts against retention, longer retention and none for critical consumers prevent it, and the gap is repaired from the source or a lake copy.
Open with
The group's committed offsets pointed at records from just before it went down. It was down 10 hours and retention is 8, so by the time it came back the segments containing those offsets had been deleted, and the committed offset was below the log start offset, which is out of range.
Then, if they want more
That is one of the two cases where auto.offset.reset applies, and with latest the consumer reset each partition to the log end offset. So it skipped the 2 hours that were deleted, but also the 8 hours that were still on disk.
Lag is end offset minus position, and the position had just been set to the end, so lag dropped to zero immediately. There is no error; the client only logs an INFO line about resetting the offset. With earliest it would have started at the log start offset and read the 8 retained hours, losing only 2.
To prevent it, I would alert on time lag, the age of the oldest unconsumed record, against retention, say at half of it, so someone acts before data is deleted.
I would make retention longer than the worst realistic recovery, days rather than hours for important topics, and for critical consumers set auto.offset.reset to none so this becomes an exception and a decision rather than a silent jump. For the repair, Kafka no longer has the data, so it has to come from the source system or a lake copy.
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 documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Kafka documentation
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 "When the group came back, lag dropped to zero at once and no errors appeared, but...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-clients-in-depth/1f11e839e7/