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

Make recovery APIs cancellable #69177

Merged

Conversation

DaveCTurner
Copy link
Contributor

Relates #55550

@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Feb 18, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (Team:Core/Features)

@@ -107,4 +111,19 @@ protected ClusterBlockException checkGlobalBlock(ClusterState state, RecoveryReq
protected ClusterBlockException checkRequestBlock(ClusterState state, RecoveryRequest request, String[] concreteIndices) {
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA_READ, concreteIndices);
}

@Nullable // unless running tests that inject extra behaviour
private volatile Runnable onShardOperation;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is totally stupid, but I just can't see a better way to block these operations for the purposes of this test.

Copy link
Member

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

LGTM

/**
* Helper method for tests to call {@link TransportRecoveryAction#setOnShardOperation}.
*/
public static void setOnShardOperation(TransportRecoveryAction transportRecoveryAction, Runnable setOnShardOperation) {
Copy link
Member

Choose a reason for hiding this comment

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

NIT: Maybe just inline this into the test class that actually uses it? Why have a separate method for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put it here so I could keep TransportRecoveryAction#setOnShardOperation package-private (without needing the test itself to be in the same package as the action)

Copy link
Member

Choose a reason for hiding this comment

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

ah ok, makes sense :)

@DaveCTurner DaveCTurner merged commit 61e6734 into elastic:master Feb 25, 2021
@DaveCTurner DaveCTurner deleted the 2021-02-18-recovery-stats-cancellable branch February 25, 2021 09:24
DaveCTurner added a commit that referenced this pull request Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Stats Statistics tracking and retrieval APIs >enhancement Team:Data Management Meta label for data/management team v7.13.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants