-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Transform] stop transform regardless of transform nodes (#69419)
allow stop transform to stop a transform task if its waiting for assignment(e.g. if the cluster lacks a transform node) fixes #69260
- Loading branch information
Hendrik Muhs
authored
Feb 24, 2021
1 parent
a64f4db
commit 4b6c280
Showing
5 changed files
with
171 additions
and
19 deletions.
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