feat(inkless): allow reading from UnifiedLog for diskless topics#553
Merged
viktorsomogyi merged 2 commits intomainfrom Mar 31, 2026
Merged
Conversation
795c2c0 to
3a87375
Compare
When a classic partition is migrated to diskless, a part of its log is still within the UnifiedLog. When fetching from an offset < disklessStartOffet, allow reading into the UnifiedLog.
3a87375 to
4b7a6de
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends diskless-topic fetch handling to support reading from the classic UnifiedLog when a diskless topic is fetched at an offset below its disklessStartOffset (e.g., during/after classic→diskless migration).
Changes:
- Add
InklessMetadataView.getDisklessStartOffset(TopicPartition)backed by the metadata image’sPartitionRegistration. - Update
ReplicaManager.fetchMessagesto route diskless fetches either to diskless storage or the classic log depending ondisklessStartOffset, and to return an explicit error for unsupported cases. - Add/adjust
ReplicaManagerTestcoverage for below-start-offset behavior and introduce a test helper toggle for the relevant broker config.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| core/src/main/scala/kafka/server/ReplicaManager.scala | Routes diskless fetches below disklessStartOffset to classic log reads (or error), and adjusts callback handling to include invalid diskless responses. |
| core/src/main/scala/kafka/server/metadata/InklessMetadataView.scala | Exposes disklessStartOffset lookup from the metadata image for a given TopicPartition. |
| core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala | Adds tests verifying unified-log fallback (enabled) and INVALID_REQUEST behavior (disabled), plus config plumbing in the test helper. |
Comments suppressed due to low confidence (1)
core/src/main/scala/kafka/server/ReplicaManager.scala:1949
- The warn message says diskless topics are not supported for follower fetch requests, but the condition now only blocks follower fetches when
disklessManagedReplicasEnabledis false. If follower fetches are actually supported when this flag is enabled, the log message is misleading; otherwise, the condition should probably remain unconditional. Please align the message/behavior so operators can rely on it during troubleshooting.
if (!config.disklessManagedReplicasEnabled && params.isFromFollower && disklessFetchInfos.nonEmpty) {
warn("Diskless topics are not supported for follower fetch requests. " +
s"Request from follower ${params.replicaId} contains diskless topics: ${disklessFetchInfos.map(_._1.topic()).mkString(", ")}")
responseCallback(Seq.empty)
return
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jeqo
previously approved these changes
Mar 30, 2026
Contributor
jeqo
left a comment
There was a problem hiding this comment.
LGTM, just a minor comment update.
Comment on lines
1946
to
1947
| warn("Diskless topics are not supported for follower fetch requests. " + | ||
| s"Request from follower ${params.replicaId} contains diskless topics: ${disklessFetchInfos.map(_._1.topic()).mkString(", ")}") |
Contributor
There was a problem hiding this comment.
Suggested change
| warn("Diskless topics are not supported for follower fetch requests. " + | |
| s"Request from follower ${params.replicaId} contains diskless topics: ${disklessFetchInfos.map(_._1.topic()).mkString(", ")}") | |
| warn(s"Follower fetch from replica ${params.replicaId} for diskless topics " + | |
| s"${disklessFetchInfos.map(_._1.topic()).distinct.mkString(", ")} " + | |
| s"rejected: managed replicas are not enabled.") |
viktorsomogyi
approved these changes
Mar 31, 2026
jeqo
pushed a commit
that referenced
this pull request
Apr 1, 2026
When a classic partition is migrated to diskless, a part of its log is still within the UnifiedLog. When fetching from an offset < disklessStartOffet, allow reading into the UnifiedLog.
jeqo
added a commit
that referenced
this pull request
Apr 1, 2026
…s-4.0 - Add TopicPartition and PartitionRegistration imports to InklessMetadataView - Use UnifiedLog.UnknownOffset instead of UnifiedLog.UNKNOWN_OFFSET (4.0 naming) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jeqo
pushed a commit
that referenced
this pull request
Apr 1, 2026
When a classic partition is migrated to diskless, a part of its log is still within the UnifiedLog. When fetching from an offset < disklessStartOffet, allow reading into the UnifiedLog.
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.
When a classic partition is migrated to diskless, a part of its log is still within the UnifiedLog. When fetching from an offset < disklessStartOffet, allow reading into the UnifiedLog.