diff --git a/CHANGELOG.md b/CHANGELOG.md index a45202c034..b3a1676a06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ We use *breaking* word for marking changes that are not backward compatible (rel ## Unreleased +### Fixed + +* [#2637](https://github.com/thanos-io/thanos/pull/2637) Compact: detect retryable errors that are inside of a wrapped `tsdb.MultiError` + ## [v0.13.0](https://github.com/thanos-io/thanos/releases) - IN PROGRESS ### Fixed diff --git a/pkg/compact/compact.go b/pkg/compact/compact.go index 09f1037443..26951b0124 100644 --- a/pkg/compact/compact.go +++ b/pkg/compact/compact.go @@ -487,7 +487,7 @@ func (e RetryError) Error() string { // IsRetryError returns true if the base error is a RetryError. // If a multierror is passed, all errors must be retriable. func IsRetryError(err error) bool { - if multiErr, ok := err.(terrors.MultiError); ok { + if multiErr, ok := errors.Cause(err).(terrors.MultiError); ok { for _, err := range multiErr { if _, ok := errors.Cause(err).(RetryError); !ok { return false diff --git a/pkg/compact/compact_test.go b/pkg/compact/compact_test.go index 29ecba297d..11ce28c638 100644 --- a/pkg/compact/compact_test.go +++ b/pkg/compact/compact_test.go @@ -50,6 +50,8 @@ func TestRetryMultiError(t *testing.T) { errs = terrors.MultiError{retryErr} testutil.Assert(t, IsRetryError(errs), "if all errors are retriable this should return true") + testutil.Assert(t, IsRetryError(errors.Wrap(errs, "wrap")), "retry error with wrap") + errs = terrors.MultiError{nonRetryErr, retryErr} testutil.Assert(t, !IsRetryError(errs), "mixed errors should return false") }