Skip to content

Conversation

@ywangd
Copy link
Member

@ywangd ywangd commented Mar 6, 2025

The method should be called with an explicit project-id to access persistent tasks from the right project. This PR does that. The callsites are updated by using the default project-id for the timebeing. They work for single project deployments but should eventually be updated for multi-project setup.

Relates: ES-11039

The method should be called with an explicit project-id to access
persistent tasks from the right project. This PR does that. The
callsites are updated by using the default project-id for the timebeing.
They work for single project deployments but should eventually be
updated for multi-project setup.
@ywangd ywangd added >non-issue :Distributed Coordination/Task Management Issues for anything around the Tasks API - both persistent and node level. v9.1.0 labels Mar 6, 2025
@ywangd ywangd requested review from a team and pxsalehi March 6, 2025 05:14
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination Meta label for Distributed Coordination team label Mar 6, 2025
Comment on lines +650 to +652
if (persistentTasksCustomMetadata == null) {
return true;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I added similar null check in most of the call sites. It looks correct to me since all usages are either waiting for all tasks to be removed or not on certain state. Additionally, the same null check is already in place for TransportStopTransformAction.

I think it's likely a noop for single project setup since the method is called only after the tasks have started. Having it feels more future proof for multi-project where project might be concurrently removed. It might be that the project deletion is orderly so that a project won't be removed until all tasks have cleared out. In that case, this check will be a noop. Overall I feel it is safer to have it in any case.

* @param timeout a timeout for waiting
* @param listener the callback listener
*/
public void waitForPersistentTasksCondition(
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason you didn't also update the (overloaded) waitForPersistentTasksCondition method above? I think it makes sense to do both within this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

The other method is not an overload, it is waitForPersistentTaskCondition, note the singular Task. I didn't touch that because you handled it in #124000?

Copy link
Contributor

@nielsbauman nielsbauman left a comment

Choose a reason for hiding this comment

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

LGTM

@ywangd
Copy link
Member Author

ywangd commented Mar 7, 2025

@elasticmachine update branch

@ywangd ywangd added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Mar 7, 2025
@elasticsearchmachine elasticsearchmachine merged commit 88b5900 into elastic:main Mar 7, 2025
17 checks passed
@ywangd ywangd deleted the mp/migrate-wait-for-tasks-condition branch March 7, 2025 03:00
georgewallace pushed a commit to georgewallace/elasticsearch that referenced this pull request Mar 11, 2025
The method should be called with an explicit project-id to access
persistent tasks from the right project. This PR does that. The
callsites are updated by using the default project-id for the timebeing.
They work for single project deployments but should eventually be
updated for multi-project setup.

Relates: ES-11039
costin pushed a commit to costin/elasticsearch that referenced this pull request Mar 15, 2025
The method should be called with an explicit project-id to access
persistent tasks from the right project. This PR does that. The
callsites are updated by using the default project-id for the timebeing.
They work for single project deployments but should eventually be
updated for multi-project setup.

Relates: ES-11039
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Distributed Coordination/Task Management Issues for anything around the Tasks API - both persistent and node level. >non-issue Team:Distributed Coordination Meta label for Distributed Coordination team v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants