Skip to content

refactor(inkless): clarify fetch routing for consolidating partitions#633

Merged
jeqo merged 2 commits into
mainfrom
jeqo/refactor-fetch-messages
Jun 5, 2026
Merged

refactor(inkless): clarify fetch routing for consolidating partitions#633
jeqo merged 2 commits into
mainfrom
jeqo/refactor-fetch-messages

Conversation

@jeqo

@jeqo jeqo commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Some minor changes to make fetch messages more readable:

  • Added logging on failing responses,
  • Reduce variables serving same purpose to reduce cognitive load
  • Renamed some variables for clarity

@jeqo
jeqo marked this pull request as ready for review June 5, 2026 13:01
@jeqo
jeqo force-pushed the jeqo/refactor-fetch-messages branch 2 times, most recently from 50b6832 to b8379f5 Compare June 5, 2026 13:17
@jeqo
jeqo requested a review from Copilot June 5, 2026 13:17

Copilot AI left a comment

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.

Pull request overview

Refactors ReplicaManager.fetchMessages routing logic for diskless vs classic fetches (including consolidating partitions), aiming to improve readability and add more diagnostic logging when partition lookup / fetch flows fail.

Changes:

  • Simplifies diskless fetch routing by removing a separate “invalid consolidating” response buffer and folding those into immediate responses.
  • Moves topic-id backfill to the routing decision point (and introduces a helper for backward-compatible topic-id backfill).
  • Adds additional warnings when partition lookup fails or when diskless fetch is rejected due to managed replicas being disabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/src/main/scala/kafka/server/ReplicaManager.scala Outdated
Comment thread core/src/main/scala/kafka/server/ReplicaManager.scala Outdated
Comment thread core/src/main/scala/kafka/server/ReplicaManager.scala Outdated
Comment thread core/src/main/scala/kafka/server/ReplicaManager.scala Outdated
@jeqo
jeqo force-pushed the jeqo/refactor-fetch-messages branch 3 times, most recently from 9bbc0b0 to 92aaf6e Compare June 5, 2026 13:51
Comment on lines +2111 to +2116
if (classicFetchInfos.isEmpty && disklessFetchInfos.isEmpty && immediateFetchResponses.nonEmpty) {
respond(Seq.empty)
return
}

if (classicFetchInfos.isEmpty && disklessFetchInfosWithoutTopicId.isEmpty &&
immediateFetchResponses.isEmpty && invalidConsolidatingPartitionFetchResponses.nonEmpty) {
if (classicFetchInfos.isEmpty && disklessFetchInfos.isEmpty && immediateFetchResponses.isEmpty) {

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.

I think you can collapse these into one if (classicFetchInfos.isEmpty && disklessFetchInfos.isEmpty) because we respond(Seq.empty) regardless of the value of immediateFetchResponses.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, even better.

@jeqo
jeqo force-pushed the jeqo/refactor-fetch-messages branch from 92aaf6e to d9aac76 Compare June 5, 2026 14:49
@jeqo
jeqo requested a review from viktorsomogyi June 5, 2026 14:52

@viktorsomogyi viktorsomogyi left a comment

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.

LGTM. Reran the Java 17 build because there was a flaky ReplicaManagerTest.testReplicaAlterLogDirsMultipleReassignmentDoesNotBlockLogCleaner(). I've seen this failing locally a couple of times too, it's some mocking wiring issue.

@jeqo
jeqo merged commit f2eb359 into main Jun 5, 2026
8 of 9 checks passed
@jeqo
jeqo deleted the jeqo/refactor-fetch-messages branch June 5, 2026 16:42
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.

3 participants