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: Defer closing blocks iter after checking error from loadWorkForGap #12934

Merged
merged 1 commit into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pkg/bloomcompactor/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@ func (s *SimpleBloomController) buildGaps(
// to try and accelerate bloom creation
level.Debug(logger).Log("msg", "loading series and blocks for gap", "blocks", len(gap.blocks))
seriesItr, blocksIter, err := s.loadWorkForGap(ctx, table, tenant, plan.tsdb, gap)
if err != nil {
level.Error(logger).Log("msg", "failed to get series and blocks", "err", err)
return nil, errors.Wrap(err, "failed to get series and blocks")
}

// TODO(owen-d): more elegant error handling than sync.OnceFunc
closeBlocksIter := sync.OnceFunc(func() {
Expand All @@ -393,11 +397,6 @@ func (s *SimpleBloomController) buildGaps(
})
defer closeBlocksIter()

if err != nil {
level.Error(logger).Log("msg", "failed to get series and blocks", "err", err)
return nil, errors.Wrap(err, "failed to get series and blocks")
}

// Blocks are built consuming the series iterator. For observability, we wrap the series iterator
// with a counter iterator to count the number of times Next() is called on it.
// This is used to observe the number of series that are being processed.
Expand Down
Loading