use of org.apache.flink.runtime.checkpoint.PrioritizedOperatorSubtaskState in project flink by apache.
the class TaskStateManagerImpl method prioritizedOperatorState.
@Override
public PrioritizedOperatorSubtaskState prioritizedOperatorState(OperatorID operatorID) {
if (jobManagerTaskRestore == null) {
return PrioritizedOperatorSubtaskState.emptyNotRestored();
}
TaskStateSnapshot jobManagerStateSnapshot = jobManagerTaskRestore.getTaskStateSnapshot();
OperatorSubtaskState jobManagerSubtaskState = jobManagerStateSnapshot.getSubtaskStateByOperatorID(operatorID);
if (jobManagerSubtaskState == null) {
return PrioritizedOperatorSubtaskState.empty(jobManagerTaskRestore.getRestoreCheckpointId());
}
long restoreCheckpointId = jobManagerTaskRestore.getRestoreCheckpointId();
TaskStateSnapshot localStateSnapshot = localStateStore.retrieveLocalState(restoreCheckpointId);
localStateStore.pruneMatchingCheckpoints((long checkpointId) -> checkpointId != restoreCheckpointId);
List<OperatorSubtaskState> alternativesByPriority = Collections.emptyList();
if (localStateSnapshot != null) {
OperatorSubtaskState localSubtaskState = localStateSnapshot.getSubtaskStateByOperatorID(operatorID);
if (localSubtaskState != null) {
alternativesByPriority = Collections.singletonList(localSubtaskState);
}
}
LOG.debug("Operator {} has remote state {} from job manager and local state alternatives {} from local " + "state store {}.", operatorID, jobManagerSubtaskState, alternativesByPriority, localStateStore);
PrioritizedOperatorSubtaskState.Builder builder = new PrioritizedOperatorSubtaskState.Builder(jobManagerSubtaskState, alternativesByPriority, jobManagerTaskRestore.getRestoreCheckpointId());
return builder.build();
}
Aggregations