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

fix(block-builder): return from Process call early if max offset is reached #15073

Merged
merged 4 commits into from
Nov 25, 2024

Conversation

ashwanthgoli
Copy link
Contributor

@ashwanthgoli ashwanthgoli commented Nov 22, 2024

What this PR does / why we need it:
Process method is incorrectly polling forever even when the Max offset for the job is already processed.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@ashwanthgoli ashwanthgoli changed the title fix(block-builder): return from Process call early if max offset is r… fix(block-builder): return from Process call early if max offset is reached Nov 22, 2024
Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

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

small bit, but lgtm

if offset >= offsets.Max {
break
if record.Offset >= offsets.Max {
return lastOffset, nil
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs a break instead so we can still send partial results through the channel. Otherwise, we'll return before sending any AppendInputs to the channel. This can cause problems if half the batch we're looking at is in the offset bounds we want and half is greater.

@ashwanthgoli ashwanthgoli marked this pull request as ready for review November 25, 2024 05:10
@ashwanthgoli ashwanthgoli requested a review from a team as a code owner November 25, 2024 05:10
@ashwanthgoli ashwanthgoli merged commit 13ea254 into main Nov 25, 2024
58 checks passed
@ashwanthgoli ashwanthgoli deleted the fix-blockbuilder-processing branch November 25, 2024 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants