fix(inkless:consume): handle error path in lastOffsetForLeaderEpoch#554
Merged
viktorsomogyi merged 1 commit intomainfrom Mar 30, 2026
Merged
fix(inkless:consume): handle error path in lastOffsetForLeaderEpoch#554viktorsomogyi merged 1 commit intomainfrom
viktorsomogyi merged 1 commit intomainfrom
Conversation
fcb9268 to
c0e5887
Compare
…or diskless topics When FetchOffsetHandler returns an error from the control plane, timestampAndOffset is empty. Check for the error first and use UNDEFINED_EPOCH_OFFSET as fallback instead of calling Optional.get() on an empty value. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c0e5887 to
1068083
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes ReplicaManager.lastOffsetForLeaderEpoch for diskless topics when the control plane returns an error and the timestampAndOffset is empty, avoiding an Optional.get() crash and returning a defined fallback offset instead.
Changes:
- Handle control-plane error results before reading
timestampAndOffset, falling back toUNDEFINED_EPOCH_OFFSET. - Add a unit test covering the diskless control-plane error path.
- Update imports to support the new logic and test.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| core/src/main/scala/kafka/server/ReplicaManager.scala | Avoids Optional.get() on empty timestampAndOffset for diskless lastOffsetForLeaderEpoch, adds fallback handling and logging. |
| core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala | Adds a regression test ensuring diskless lastOffsetForLeaderEpoch returns the correct error code and UNDEFINED_EPOCH_OFFSET when the control plane errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
viktorsomogyi
approved these changes
Mar 30, 2026
jeqo
added a commit
that referenced
this pull request
Mar 30, 2026
…or diskless topics (#554) When FetchOffsetHandler returns an error from the control plane, timestampAndOffset is empty. Check for the error first and use UNDEFINED_EPOCH_OFFSET as fallback instead of calling Optional.get() on an empty value.
jeqo
added a commit
that referenced
this pull request
Mar 30, 2026
…or diskless topics (#554) When FetchOffsetHandler returns an error from the control plane, timestampAndOffset is empty. Check for the error first and use UNDEFINED_EPOCH_OFFSET as fallback instead of calling Optional.get() on an empty value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
for diskless topics
When FetchOffsetHandler returns an error from the control plane, timestampAndOffset is empty. Check for the error first and use UNDEFINED_EPOCH_OFFSET as fallback instead of calling Optional.get() on an empty value.