Class CommittableCollector<CommT>
- java.lang.Object
-
- org.apache.flink.streaming.runtime.operators.sink.committables.CommittableCollector<CommT>
-
- Type Parameters:
CommT- type of committable
@Internal public class CommittableCollector<CommT> extends Object
This class is responsible to book-keep the committing progress across checkpoints and subtasks. It handles the emission of committables and theCommittableSummary.
-
-
Constructor Summary
Constructors Constructor Description CommittableCollector(int subtaskId, int numberOfSubtasks)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMessage(CommittableMessage<CommT> message)Adds aCommittableMessageto the collector to hold it until emission.CommittableCollector<CommT>copy()Returns a new committable collector that deep copies all internals.Collection<? extends CheckpointCommittableManager<CommT>>getCheckpointCommittablesUpTo(long checkpointId)Returns allCheckpointCommittableManageruntil the requested checkpoint id.CommittableManager<CommT>getEndOfInputCommittable()ReturnsCheckpointCommittableManagerthat is currently hold by the collector and associated with theEOIcheckpoint id.intgetNumberOfSubtasks()Returns number of subtasks.intgetSubtaskId()Returns subtask id.booleanisFinished()Returns whether allCheckpointCommittableManagercurrently hold by the collector are either committed or failed.voidmerge(CommittableCollector<CommT> cc)Merges all information from an external collector into this collector.static <CommT> CommittableCollector<CommT>of(org.apache.flink.api.common.functions.RuntimeContext context)Creates aCommittableCollectorbased on the current runtime information.
-
-
-
Method Detail
-
of
public static <CommT> CommittableCollector<CommT> of(org.apache.flink.api.common.functions.RuntimeContext context)
Creates aCommittableCollectorbased on the current runtime information. This method should be used for to instantiate a collector for all Sink V2.- Type Parameters:
CommT- type of the committable- Parameters:
context- holding runtime of information- Returns:
CommittableCollector
-
addMessage
public void addMessage(CommittableMessage<CommT> message)
Adds aCommittableMessageto the collector to hold it until emission.- Parameters:
message- eitherCommittableSummaryorCommittableWithLineage
-
getCheckpointCommittablesUpTo
public Collection<? extends CheckpointCommittableManager<CommT>> getCheckpointCommittablesUpTo(long checkpointId)
Returns allCheckpointCommittableManageruntil the requested checkpoint id.- Parameters:
checkpointId- counter- Returns:
- collection of
CheckpointCommittableManager
-
getEndOfInputCommittable
@Nullable public CommittableManager<CommT> getEndOfInputCommittable()
ReturnsCheckpointCommittableManagerthat is currently hold by the collector and associated with theEOIcheckpoint id.- Returns:
CheckpointCommittableManager
-
isFinished
public boolean isFinished()
Returns whether allCheckpointCommittableManagercurrently hold by the collector are either committed or failed.- Returns:
- state of the
CheckpointCommittableManager
-
merge
public void merge(CommittableCollector<CommT> cc)
Merges all information from an external collector into this collector.This method is important during recovery from existing state.
- Parameters:
cc- otherCommittableCollector
-
getNumberOfSubtasks
public int getNumberOfSubtasks()
Returns number of subtasks.- Returns:
- number of subtasks
-
getSubtaskId
public int getSubtaskId()
Returns subtask id.- Returns:
- subtask id.
-
copy
public CommittableCollector<CommT> copy()
Returns a new committable collector that deep copies all internals.- Returns:
CommittableCollector
-
-