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

perf(blooms): always return bloom pages to allocator #13288

Merged
merged 2 commits into from
Jun 24, 2024

Conversation

owen-d
Copy link
Member

@owen-d owen-d commented Jun 21, 2024

No description provided.

@owen-d owen-d marked this pull request as ready for review June 24, 2024 15:11
@owen-d owen-d requested a review from a team as a code owner June 24, 2024 15:11
Comment on lines 116 to 124

defer func() {
for i := range bqs {
if bqs[i] == nil {
continue
}
bqs[i].Close()
}
}()
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I miss something, but we don't seem to close the block remaining block queriers any more in case one p.processBlock() fails, since concurrency.ForEachJob() returns on first error.

Copy link
Member Author

Choose a reason for hiding this comment

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

The closing has moved into processBlock itself so we can cleanup & return to the buffer pool as blocks individually finish, not after they all do. This also helps prevent issues if/when we start blocking on pool accesses where further blocks could hang waiting for Gets from the buffer pool that haven't been returned from previous blocks.

var errs multierror.MultiError
errs.Add(err)
errs.Add(bq.Close())
err = errs.Err()
Copy link
Contributor

Choose a reason for hiding this comment

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

That looks wrong, since on line 141 you add err to the multi-error.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's capturing the err from the function signature and adding it to the multi-error (which can now have a main error from the body of the function call and/or an error from cleanup.

Copy link
Contributor

@chaudum chaudum left a comment

Choose a reason for hiding this comment

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

lgtm

@owen-d owen-d merged commit 0cb3ff1 into grafana:main Jun 24, 2024
60 checks passed
chaudum added a commit that referenced this pull request Jun 25, 2024
The slice of block queriers can contain `nil` values, which causes nip
pointer dereference when calling `Close()` on them.

The regression was introduced with PR #13288

Signed-off-by: Christian Haudum <[email protected]>
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