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

compact: unwrap the original error as well #2637

Merged
merged 3 commits into from
May 21, 2020

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.

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