Skip to content

feat(inkless): allow reading from UnifiedLog for diskless topics#553

Merged
viktorsomogyi merged 2 commits intomainfrom
giuseppelillo/fetch-path-with-disklessstartoffset
Mar 31, 2026
Merged

feat(inkless): allow reading from UnifiedLog for diskless topics#553
viktorsomogyi merged 2 commits intomainfrom
giuseppelillo/fetch-path-with-disklessstartoffset

Conversation

@giuseppelillo
Copy link
Copy Markdown
Contributor

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.

@giuseppelillo giuseppelillo force-pushed the giuseppelillo/fetch-path-with-disklessstartoffset branch 4 times, most recently from 795c2c0 to 3a87375 Compare March 30, 2026 15:01
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.
@giuseppelillo giuseppelillo force-pushed the giuseppelillo/fetch-path-with-disklessstartoffset branch from 3a87375 to 4b7a6de Compare March 30, 2026 15:07
@giuseppelillo giuseppelillo requested a review from Copilot March 30, 2026 15:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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’s PartitionRegistration.
  • Update ReplicaManager.fetchMessages to route diskless fetches either to diskless storage or the classic log depending on disklessStartOffset, and to return an explicit error for unsupported cases.
  • Add/adjust ReplicaManagerTest coverage 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 disklessManagedReplicasEnabled is 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.

Comment thread core/src/main/scala/kafka/server/ReplicaManager.scala
Comment thread core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala
@giuseppelillo giuseppelillo marked this pull request as ready for review March 30, 2026 16:48
jeqo
jeqo previously approved these changes Mar 30, 2026
Copy link
Copy Markdown
Contributor

@jeqo jeqo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(", ")}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 viktorsomogyi merged commit c6007bc into main Mar 31, 2026
5 checks passed
@viktorsomogyi viktorsomogyi deleted the giuseppelillo/fetch-path-with-disklessstartoffset branch March 31, 2026 08:24
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants