public class ExecutionTask extends Object implements Comparable<ExecutionTask>
----------------------> TO_RETRY | ᐃ | | | | (at most once) ᐁ | PENDING ---> IN_PROGRESS ------------> COMPLETED | | |-----------------> ABORTING ----> ABORTED | | | v |-------------------> DEAD A newly created task is in PENDING state. A PENDING task becomes IN_PROGRESS when it is drained from theExecutionTaskPlanner
An IN_PROGRESS task becomes TO_RETRY if the execution throws anInvalidReplicaAssignmentException
. A task can enter this state only once. A TO_RETRY task becomes PENDING afterKafkaCruiseControlConfig.INVALID_REPLICA_ASSIGNMENT_RETRY_TIMEOUT_MS_CONFIG
. An IN_PROGRESS task becomes COMPLETED if the execution is done without error. An IN_PROGRESS task becomes ABORTING if an error is encountered and the rollback is possible. An IN_PROGRESS task becomes DEAD if an error is encountered and the rollback is not possible. An ABORTING task becomes ABORTED if the rollback of the original task is successfully done or the original proposal successfully applied (in the case of a race-condition where we mark it as aborting right before completion). An ABORTING task becomes DEAD if the rollback of the original task encountered an error.
Modifier and Type | Class and Description |
---|---|
static class |
ExecutionTask.State
The state of a balancing proposal.
|
static class |
ExecutionTask.TaskType |
Constructor and Description |
---|
ExecutionTask(long executionId,
ExecutionProposal proposal,
ExecutionTask.TaskType type) |
ExecutionTask(long executionId,
ExecutionProposal proposal,
Integer brokerId,
ExecutionTask.TaskType type)
Construct an execution task.
|
Modifier and Type | Method and Description |
---|---|
void |
abort()
Abort the task.
|
void |
aborted(long now)
Change the task state to aborted.
|
int |
brokerId() |
boolean |
canTransferToState(ExecutionTask.State targetState)
Check if the state transfer is possible.
|
int |
compareTo(ExecutionTask o) |
void |
completed(long now)
Change the task state to completed.
|
long |
endTime() |
boolean |
equals(Object o) |
long |
executionId() |
Map<String,Object> |
getJsonStructure()
Return an object that can be further used
to encode into JSON
|
int |
hashCode() |
void |
inProgress(long now)
Mark task in progress.
|
void |
kill(long now)
Kill the task.
|
void |
pending()
Mark the task back in the pending state.
|
ExecutionProposal |
proposal() |
int |
requiredParallelism() |
long |
startTime() |
ExecutionTask.State |
state() |
void |
toBeRetried()
Mark the task to be retried
|
String |
toString() |
ExecutionTask.TaskType |
type() |
Set<ExecutionTask.State> |
validTargetState() |
public ExecutionTask(long executionId, ExecutionProposal proposal, Integer brokerId, ExecutionTask.TaskType type)
executionId
- The execution id of the proposal so we can keep track of the task when execute it.proposal
- The corresponding balancing proposal of this task.brokerId
- The broker to operate on if the task is of type ExecutionTask.TaskType.INTRA_BROKER_REPLICA_ACTION
.type
- the ExecutionTask.TaskType
of this task.public ExecutionTask(long executionId, ExecutionProposal proposal, ExecutionTask.TaskType type)
public boolean canTransferToState(ExecutionTask.State targetState)
targetState
- the state to transfer to.public Set<ExecutionTask.State> validTargetState()
public long executionId()
public ExecutionProposal proposal()
public ExecutionTask.TaskType type()
public ExecutionTask.State state()
public long startTime()
public long endTime()
public int brokerId()
public int requiredParallelism()
public void pending()
public void inProgress(long now)
public void toBeRetried()
public void kill(long now)
public void abort()
public void aborted(long now)
public void completed(long now)
public Map<String,Object> getJsonStructure()
public int compareTo(ExecutionTask o)
compareTo
in interface Comparable<ExecutionTask>