Skip to content

Conversation

@fcofdez
Copy link
Contributor

@fcofdez fcofdez commented Apr 28, 2021

Take into account that the task can be cancelled after the check for
acceptableClusterStateOrFailedPredicate has been performed and
it could trip the assertion.

Closes #72056

Take into account that the task can be cancelled after the check has
been performed and it could trip the assertion.

Closes elastic#72056
@fcofdez fcofdez added >test Issues or PRs that are addressing/adding tests :Distributed Coordination/Task Management Issues for anything around the Tasks API - both persistent and node level. v8.0.0 Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v7.14.0 labels Apr 28, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@fcofdez
Copy link
Contributor Author

fcofdez commented Apr 29, 2021

@elasticmachine update branch

// It is possible that the task is cancelled after the predicate has been executed, therefore we should take
// that into account as well for the assertion
assert acceptableClusterStateOrFailedPredicate.test(state) == false
|| request.local() == false && cancellableTask.isCancelled();
Copy link
Contributor

Choose a reason for hiding this comment

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

I was expecting the cancellableTask.isCancelled() here but not the request.local() check. Digging into why that's needed led me to conclude that there's a bug in #67413: local requests should also complete on the first cluster state update after cancellation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, I've moved the cancellation check outside of acceptableClusterStateOrFailedPredicate making it deterministic given the same ClusterState. Now we check for cancellation in local requests too.

@fcofdez fcofdez requested a review from DaveCTurner April 29, 2021 12:11
Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

LGTM

clusterStateRequest.addParameter("wait_for_metadata_version", Long.toString(Long.MAX_VALUE));
clusterStateRequest.addParameter("wait_for_timeout", "1h");
if (randomBoolean()) {
clusterStateRequest.addParameter("local", "true");
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@fcofdez fcofdez merged commit 0583433 into elastic:master Apr 29, 2021
fcofdez added a commit to fcofdez/elasticsearch that referenced this pull request Apr 29, 2021
Take into account task cancellation for local requests too

Closes elastic#72056
Backport of elastic#72407
fcofdez added a commit that referenced this pull request Apr 29, 2021
Take into account task cancellation for local requests too

Closes #72056
Backport of #72407
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Coordination/Task Management Issues for anything around the Tasks API - both persistent and node level. Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. >test Issues or PRs that are addressing/adding tests v7.14.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] ClusterStateRestCancellationIT testClusterStateRestCancellation trips assertion

4 participants