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

Ensure error handler is called during SLM retention callback failure #55252

Merged
merged 2 commits into from
Apr 16, 2020

Conversation

dakrone
Copy link
Member

@dakrone dakrone commented Apr 15, 2020

When retrieving the snapshots for a set of repos or deleting a single snapshot, it's possible for
the body of the ActionListener's onResponse method to throw an Exception. In this case, the
errHandler passed in may not be executed, resulting in the running boolean not being reset back
to false.

This commit uses ActionListener.wrap(...) instead of creating a new ActionListener, which ensures
that if the onResponse fails in any way, the onFailure handler is still called.

Resolves #55217

When retrieving the snapshots for a set of repos or deleting a single snapshot, it's possible for
the body of the `ActionListener`'s `onResponse` method to throw an Exception. In this case, the
`errHandler` passed in may not be executed, resulting in the `running` boolean not being reset back
to false.

This commit uses `ActionListener.wrap(...)` instead of creating a new ActionListener, which ensures
that if the `onResponse` fails in any way, the `onFailure` handler is still called.

Resolves elastic#55217
@dakrone dakrone added >bug :Data Management/ILM+SLM Index and Snapshot lifecycle management v8.0.0 v7.8.0 v7.7.1 labels Apr 15, 2020
@dakrone dakrone requested a review from andreidan April 15, 2020 18:19
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/ILM+SLM)

@dakrone
Copy link
Member Author

dakrone commented Apr 15, 2020

@elasticmachine update branch


@Override
public void onFailure(Exception e) {
fail("we have another err handler that should have been called");
Copy link
Contributor

Choose a reason for hiding this comment

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

I found this confusing, but I see it's just how getAllRetainableSnapshots does the listener callback, so maybe it's a discussion we should have on a separate ocasion

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, we can do that maybe in future work since it's technically not really a bugfix.

Copy link
Contributor

@andreidan andreidan left a comment

Choose a reason for hiding this comment

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

LGTM thanks for fixing this Lee

@dakrone dakrone merged commit cc18caf into elastic:master Apr 16, 2020
@dakrone dakrone deleted the slm-ensure-errhandlers-are-called branch April 16, 2020 15:36
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Apr 16, 2020
…lastic#55252)

When retrieving the snapshots for a set of repos or deleting a single snapshot, it's possible for
the body of the `ActionListener`'s `onResponse` method to throw an Exception. In this case, the
`errHandler` passed in may not be executed, resulting in the `running` boolean not being reset back
to false.

This commit uses `ActionListener.wrap(...)` instead of creating a new ActionListener, which ensures
that if the `onResponse` fails in any way, the `onFailure` handler is still called.

Resolves elastic#55217
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Apr 16, 2020
…lastic#55252)

When retrieving the snapshots for a set of repos or deleting a single snapshot, it's possible for
the body of the `ActionListener`'s `onResponse` method to throw an Exception. In this case, the
`errHandler` passed in may not be executed, resulting in the `running` boolean not being reset back
to false.

This commit uses `ActionListener.wrap(...)` instead of creating a new ActionListener, which ensures
that if the `onResponse` fails in any way, the `onFailure` handler is still called.

Resolves elastic#55217
dakrone added a commit that referenced this pull request Apr 16, 2020
…55252) (#55321)

When retrieving the snapshots for a set of repos or deleting a single snapshot, it's possible for
the body of the `ActionListener`'s `onResponse` method to throw an Exception. In this case, the
`errHandler` passed in may not be executed, resulting in the `running` boolean not being reset back
to false.

This commit uses `ActionListener.wrap(...)` instead of creating a new ActionListener, which ensures
that if the `onResponse` fails in any way, the `onFailure` handler is still called.

Resolves #55217
dakrone added a commit that referenced this pull request Apr 16, 2020
…55252) (#55324)

When retrieving the snapshots for a set of repos or deleting a single snapshot, it's possible for
the body of the `ActionListener`'s `onResponse` method to throw an Exception. In this case, the
`errHandler` passed in may not be executed, resulting in the `running` boolean not being reset back
to false.

This commit uses `ActionListener.wrap(...)` instead of creating a new ActionListener, which ensures
that if the `onResponse` fails in any way, the `onFailure` handler is still called.

Resolves #55217
yyff pushed a commit to yyff/elasticsearch that referenced this pull request Apr 17, 2020
…lastic#55252)

When retrieving the snapshots for a set of repos or deleting a single snapshot, it's possible for
the body of the `ActionListener`'s `onResponse` method to throw an Exception. In this case, the
`errHandler` passed in may not be executed, resulting in the `running` boolean not being reset back
to false.

This commit uses `ActionListener.wrap(...)` instead of creating a new ActionListener, which ensures
that if the `onResponse` fails in any way, the `onFailure` handler is still called.

Resolves elastic#55217
@bpintea bpintea added v7.7.0 and removed v7.7.1 labels Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SnapshotRetentionTask#getAllRetainableSnapshots Exception Handling is Broken
5 participants