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-18683: Handle slicing of file records for updated start position #18759

Merged
merged 3 commits into from
Jan 31, 2025

Conversation

apoorvmittal10
Copy link
Collaborator

@apoorvmittal10 apoorvmittal10 commented Jan 31, 2025

The PR corrects the check which was introduced in #5332 where position is checked to be within boundaries of file. However the check position > currentSizeInBytes - start:

  1. shall always fail when the slice of file record has moved start, and size of the slice is lesser than start position.
  2. is incorrect, as the position is relative to start hence there can be data which could be further sliced but as start is subtracted from size then it might fail.

This PR avoids subtracting start from available size as the position for slicing is already relative to the start hence just checking if the position is lesser than the size confirms the boundary.

@github-actions github-actions bot added triage PRs from the community clients small Small PRs labels Jan 31, 2025
@apoorvmittal10 apoorvmittal10 added ci-approved and removed triage PRs from the community clients labels Jan 31, 2025
@apoorvmittal10 apoorvmittal10 changed the title WIP: Handle slicing of file records for updated start position KAFKA-18683: Handle slicing of file records for updated start position Jan 31, 2025
Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@apoorvmittal10 : Thanks for the PR. LGTM

@junrao junrao merged commit 484ba83 into apache:trunk Jan 31, 2025
9 checks passed
pdruley pushed a commit to pdruley/kafka that referenced this pull request Feb 12, 2025
apache#18759)

The PR corrects the check which was introduced in apache#5332 where position is checked to be within boundaries of file. The check 
    position > currentSizeInBytes - start 
is incorrect, since the position is relative to start.

Reviewers: Jun Rao <[email protected]>
manoj-mathivanan pushed a commit to manoj-mathivanan/kafka that referenced this pull request Feb 19, 2025
apache#18759)

The PR corrects the check which was introduced in apache#5332 where position is checked to be within boundaries of file. The check 
    position > currentSizeInBytes - start 
is incorrect, since the position is relative to start.

Reviewers: Jun Rao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants