-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
[Transform] stop transform regardless of transform nodes #69419
Merged
hendrikmuhs
merged 7 commits into
elastic:master
from
hendrikmuhs:transform-no-transform-node-stop
Feb 24, 2021
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
67bf5a8
allow stop transform to stop transform if its waiting for assigment(e…
2e4d72c
revert moving setExpandedId to avoid NPE
da4ea8e
add tests form transform node assignments
697265c
fix collection of stopped transforms
5c18224
Apply suggestions from code review
hendrikmuhs ee5a51e
Apply suggestions from code review
hendrikmuhs 2e6cd41
simplify according to review comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
...form/src/main/java/org/elasticsearch/xpack/transform/action/TransformNodeAssignments.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.transform.action; | ||
|
||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
/** | ||
* Record of transform tasks and their current persistent task state. | ||
* | ||
* This class is aimed to be used by start/stop and stats action. | ||
*/ | ||
public final class TransformNodeAssignments { | ||
|
||
// set of nodes where requested transforms are executed on | ||
private final Set<String> executorNodes; | ||
// set of transforms that are currently assigned to a node | ||
private final Set<String> assigned; | ||
// set of transforms that currently wait for node assignment | ||
private final Set<String> waitingForAssignment; | ||
// set of transforms that have neither a task nor wait for assignment, so considered stopped | ||
private final Set<String> stopped; | ||
|
||
TransformNodeAssignments( | ||
final Set<String> executorNodes, | ||
final Set<String> assigned, | ||
final Set<String> waitingForAssignment, | ||
final Set<String> stopped | ||
) { | ||
this.executorNodes = Collections.unmodifiableSet(executorNodes); | ||
this.assigned = Collections.unmodifiableSet(assigned); | ||
this.waitingForAssignment = Collections.unmodifiableSet(waitingForAssignment); | ||
this.stopped = Collections.unmodifiableSet(stopped); | ||
} | ||
|
||
/* | ||
* Get nodes where (requested) transforms are executed. | ||
*/ | ||
public Set<String> getExecutorNodes() { | ||
return executorNodes; | ||
} | ||
|
||
/* | ||
* Get transforms which have tasks currently assigned to a node | ||
*/ | ||
public Set<String> getAssigned() { | ||
return assigned; | ||
} | ||
|
||
/* | ||
* Get transforms which are currently waiting to be assigned to a node | ||
*/ | ||
public Set<String> getWaitingForAssignment() { | ||
return waitingForAssignment; | ||
} | ||
|
||
/* | ||
* Get transforms which have no tasks, which means they are stopped | ||
*/ | ||
public Set<String> getStopped() { | ||
return stopped; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
So, what is there left to do? Aren't waiting tasks handled by
cancelTransformTasksWithNoAssignment
?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 the special case were the transform "lost" the configuration, meaning it could not be found in the transform index. This happens if you e.g. manually delete the document or the whole index.
I still think we should handle it, but I like to postpone it to the follow up, I added the todo there.