Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-18522: Slice records for share fetch #18804

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

apoorvmittal10
Copy link
Collaborator

The PR handles slicing of fetched records based on acquire response for share fetch. There could be additional bytes fetched from log but acquired offsets can be a subset, typically with max fetch records configuration. Rather sending additional bytes of fetched data to client we should slice the file and wire only needed batches.

Note: If the acquired offsets are within a batch then we need to send the entire batch within the file record. Hence rather checking for inidividual batches, PR finds the first and last acquired offset, and trims the file for all batches between (inclusive) these two offsets.

@github-actions github-actions bot added triage PRs from the community core Kafka Broker KIP-932 Queues for Kafka build Gradle build or GitHub Actions labels Feb 4, 2025
@apoorvmittal10 apoorvmittal10 removed the triage PRs from the community label Feb 4, 2025
Copy link

@Copilot 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.

Copilot reviewed 5 out of 9 changed files in this pull request and generated 1 comment.

Files not reviewed (4)
  • gradle/spotbugs-exclude.xml: Language not supported
  • core/src/test/java/kafka/server/share/ShareFetchUtilsTest.java: Evaluated as low risk
  • core/src/test/java/kafka/server/share/SharePartitionManagerTest.java: Evaluated as low risk
  • core/src/test/java/kafka/server/share/DelayedShareFetchTest.java: Evaluated as low risk
Comments suppressed due to low confidence (3)

core/src/test/java/kafka/server/share/SharePartitionTest.java:5898

  • Consider overloading the fetchAcquiredRecords method instead of adding a boolean flag for subsetAcquired.
private List<AcquiredRecords> fetchAcquiredRecords(

core/src/test/java/kafka/server/share/SharePartitionTest.java:5914

  • Ensure that the memoryRecordsBuilder method from ShareFetchTestUtils is used consistently across all tests.
return memoryRecordsBuilder(numOfRecords, startOffset).build();

server/src/main/java/org/apache/kafka/server/share/fetch/ShareAcquiredRecords.java:45

  • Ensure that the subsetAcquired flag is properly tested to verify the slicing logic works correctly when this flag is true or false.
private final boolean subsetAcquired;

Copy link

@Copilot 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.

Copilot reviewed 5 out of 9 changed files in this pull request and generated 1 comment.

Files not reviewed (4)
  • gradle/spotbugs-exclude.xml: Language not supported
  • core/src/main/java/kafka/server/share/ShareFetchUtils.java: Evaluated as low risk
  • core/src/main/java/kafka/server/share/SharePartition.java: Evaluated as low risk
  • core/src/test/java/kafka/server/share/DelayedShareFetchTest.java: Evaluated as low risk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Gradle build or GitHub Actions core Kafka Broker KIP-932 Queues for Kafka
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant