prudhvi9121 opened a new pull request, #22437:
URL: https://github.com/apache/kafka/pull/22437
## Changes
### Task 2 — Log Truncation Detection (Fail-Fast)
- Detects offset gaps in `verifyOffsetSequence()` during active polling
- Detects purged records at startup in `initializeConsumer()` by comparing
MM2's committed offset against the broker's earliest available offset
- On detection: logs `[CRITICAL DATA LOSS AT STARTUP]` and calls
`Exit.exit(1)`
to ensure the container restarts visibly (Connect swallows
RuntimeExceptions)
### Task 3 — Graceful Topic Reset Handling
- Mid-stream detection in `verifyOffsetSequence()`: actual offset < expected
means the topic was deleted and recreated; seeks to beginning automatically
- Startup detection in `initializeConsumer()`: compares committed offset+1
against the broker's current log end offset; if our position is beyond the
log end and the topic starts at 0, it's a reset — seeks to beginning and
logs
`[TOPIC RESET DETECTED]`
## Testing
- `MirrorSourceTaskTest`: 8 unit tests covering all detection paths
- Integration verified via `run_challenge.sh` with Docker Compose
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]