Skip to content

compact: unwrap the original error as well#2637

Merged
bwplotka merged 3 commits intothanos-io:masterfrom
GiedriusS:detect_retryable_errors
May 21, 2020
Merged

compact: unwrap the original error as well#2637
bwplotka merged 3 commits intothanos-io:masterfrom
GiedriusS:detect_retryable_errors

Conversation

@GiedriusS
Copy link
Member

@GiedriusS GiedriusS commented May 21, 2020

Just like in IsHaltError(), let's unwrap the given error to see if is
terrors.MultiError. This lets us detect the retryable errors as well:

  • BucketCompactor.Compact returns terrors.MultiError of wrapped
    errors;
  • compactMainFn wraps the previously returned error again.

So, we need to unwrap it at the beginning, iterate over it, and then
unwrap again which is what the code does with this change.

Signed-off-by: Giedrius Statkevičius giedriuswork@gmail.com

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

IsRetryError() now detects wrapped terrors.MultiError which is what happens in some (if not all) cases.

Verification

Amended unit tests.

GiedriusS added 3 commits May 21, 2020 11:49
Just like in IsHaltError(), let's unwrap the given error to see if is
`terrors.MultiError`. This lets us detect the retryable errors as well:

* `BucketCompactor.Compact` returns `terrors.MultiError` of wrapped
errors;
* `compactMainFn` wraps the previously returned error again.

So, we need to unwrap it at the beginning, iterate over it, and then
unwrap again which is what the code does with this change.

Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>
Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>
Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>
Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants