-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Make recovery APIs cancellable #69177
Conversation
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok, makes sense :)
Relates #55550