Skip to content

Conversation

@kamalcph
Copy link
Contributor

@kamalcph kamalcph commented Oct 15, 2025

When the FETCH request read from remote log for multiple partitions,
then all the partitions are marked with minOneMessage as true. This is
not the expected behavior:

Assume that the FETCH request is configured with fetchMaxBytes as 50 MB
and max.partition.fetch.bytes as 1 MB. And, the broker is hosting 5
partitions as leader for the topic. The FETCH request might try to read
the data from remote for all the 5 partitions. If the size of the
message in the topic is 30 MB, then we might be returning back 150 MB of
response instead of 30 MB due to minOneMessage set to true for all the
remote-read requests.

Mark the minOneMessage as false when delayedRemoteFetch is present in
the first partition.

Discussion thread:
#20088 (comment)

Reviewers: Luke Chen [email protected], Satish Duggana
[email protected]

@github-actions github-actions bot added triage PRs from the community core Kafka Broker labels Oct 15, 2025
@kamalcph
Copy link
Contributor Author

This PR is built on top of #20654

…is present in the first partition.

- Update unit test to preserve the partition order while sending remote fetch requests
- Use linkedHashMap to preserve the order of partitions while processing RemoteFetch requests.
@github-actions github-actions bot added the small Small PRs label Oct 15, 2025
@kamalcph kamalcph requested review from satishd and showuon October 15, 2025 16:53
Copy link
Member

@showuon showuon left a comment

Choose a reason for hiding this comment

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

LGTM!

@github-actions github-actions bot removed the triage PRs from the community label Oct 16, 2025
Copy link
Member

@satishd satishd left a comment

Choose a reason for hiding this comment

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

Thanks @kamalcph for the PR. LGTM.


// topic-partitions that have to be read from remote storage
val remoteFetchInfos = new util.HashMap[TopicIdPartition, RemoteStorageFetchInfo]()
val remoteFetchInfos = new util.LinkedHashMap[TopicIdPartition, RemoteStorageFetchInfo]()
Copy link
Member

Choose a reason for hiding this comment

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

Good to have this as LinkedHashMap so that we try processing the topic partitions in the order sent by the client.

@satishd
Copy link
Member

satishd commented Oct 16, 2025

@kamalcph Please update the PR with the detailed change description here.

@kamalcph kamalcph changed the title KAFKA-19763: Mark the minOneMessage as false when delayedRemoteFetch is present in the first partition. KAFKA-19795: Mark the minOneMessage as false when delayedRemoteFetch is present in the first partition. Oct 16, 2025
@kamalcph kamalcph merged commit 087028c into apache:trunk Oct 16, 2025
29 checks passed
@kamalcph kamalcph deleted the KAFKA-19763a branch October 17, 2025 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Kafka Broker small Small PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants