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

Fixed the compactor successfully exiting when actually an error occurred while compacting a blocks group #1931

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ We use *breaking* word for marking changes that are not backward compatible (rel
- [#1856](https://github.com/thanos-io/thanos/pull/1856) Receive: close DBReadOnly after flushing to fix a memory leak.
- [#1882](https://github.com/thanos-io/thanos/pull/1882) Receive: upload to object storage as 'receive' rather than 'sidecar'.
- [#1907](https://github.com/thanos-io/thanos/pull/1907) Store: Fixed the duration unit for the metric `thanos_bucket_store_series_gate_duration_seconds`.
- [#1931](https://github.com/thanos-io/thanos/pull/1931) Compact: Fixed the compactor successfully exiting when actually an error occurred while compacting a blocks group.

### Added
- [#1852](https://github.com/thanos-io/thanos/pull/1852) Add support for `AWS_CONTAINER_CREDENTIALS_FULL_URI` by upgrading to minio-go v6.0.44
Expand Down
20 changes: 12 additions & 8 deletions pkg/compact/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -1131,26 +1131,30 @@ func (c *BucketCompactor) Compact(ctx context.Context) error {
}

// Send all groups found during this pass to the compaction workers.
var groupErrs terrors.MultiError

groupLoop:
for _, g := range groups {
select {
case err = <-errChan:
case groupErr := <-errChan:
groupErrs.Add(groupErr)
break groupLoop
case groupChan <- g:
}
}
close(groupChan)
wg.Wait()

// Collect any other error reported by the workers, or any error reported
// while we were waiting for the last batch of groups to run the compaction.
close(errChan)
for groupErr := range errChan {
groupErrs.Add(groupErr)
}

workCtxCancel()
if err != nil {
errs := terrors.MultiError{err}
// Collect any other errors reported by the workers.
for e := range errChan {
errs.Add(e)
}
return errs
if len(groupErrs) > 0 {
return groupErrs
}

if finishedAllGroups {
Expand Down