类 HeadOperator
- java.lang.Object
-
- org.apache.flink.streaming.api.operators.AbstractStreamOperator<IterationRecord<?>>
-
- org.apache.flink.iteration.operator.HeadOperator
-
- 所有已实现的接口:
Serializable,org.apache.flink.api.common.state.CheckpointListener,org.apache.flink.runtime.operators.coordination.OperatorEventHandler,org.apache.flink.statefun.flink.core.feedback.FeedbackConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord<IterationRecord<?>>>,org.apache.flink.streaming.api.operators.BoundedOneInput,org.apache.flink.streaming.api.operators.Input<IterationRecord<?>>,org.apache.flink.streaming.api.operators.KeyContext,org.apache.flink.streaming.api.operators.OneInputStreamOperator<IterationRecord<?>,IterationRecord<?>>,org.apache.flink.streaming.api.operators.SetupableStreamOperator<IterationRecord<?>>,org.apache.flink.streaming.api.operators.StreamOperator<IterationRecord<?>>,org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator
public class HeadOperator extends org.apache.flink.streaming.api.operators.AbstractStreamOperator<IterationRecord<?>> implements org.apache.flink.streaming.api.operators.OneInputStreamOperator<IterationRecord<?>,IterationRecord<?>>, org.apache.flink.statefun.flink.core.feedback.FeedbackConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord<IterationRecord<?>>>, org.apache.flink.runtime.operators.coordination.OperatorEventHandler, org.apache.flink.streaming.api.operators.BoundedOneInput
The head operator unions the initialized variable stream and the feedback stream, synchronize the epoch watermark (round) and taking care of the checkpoints.Specially for checkpoint, the head operator would like to
- Ensures the exactly-once for processing elements.
- Ensures the exactly-once for
IterationListener.onEpochWatermarkIncremented(int, IterationListener.Context, Collector).
To implement the first target, the head operator also need to include the records between alignment and received barrier from the feed-back edge into the snapshot. To implement the second target, the head operator would also wait for the notification from the OperatorCoordinator in additional to the task inputs. This ensures the
GloballyAlignedEventwould not interleave with the epoch watermarks and all the tasks inside the iteration would be notified with the same epochs, which facility the rescaling in the future.- 另请参阅:
- 序列化表格
-
-
字段概要
字段 修饰符和类型 字段 说明 static org.apache.flink.util.OutputTag<IterationRecord<Void>>ALIGN_NOTIFY_OUTPUT_TAG
-
构造器概要
构造器 构造器 说明 HeadOperator(IterationID iterationId, int feedbackIndex, boolean isCriteriaStream, org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor, org.apache.flink.runtime.operators.coordination.OperatorEventGateway operatorEventGateway, org.apache.flink.streaming.runtime.tasks.ProcessingTimeService processingTimeService)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidclose()voidendInput()org.apache.flink.runtime.operators.coordination.OperatorEventGatewaygetOperatorEventGateway()org.apache.flink.iteration.operator.HeadOperator.HeadOperatorStatusgetStatus()voidhandleOperatorEvent(org.apache.flink.runtime.operators.coordination.OperatorEvent operatorEvent)voidinitializeState(org.apache.flink.runtime.state.StateInitializationContext context)voidnotifyCheckpointAborted(long checkpointId)voidprepareSnapshotPreBarrier(long checkpointId)voidprocessElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<IterationRecord<?>> element)voidprocessFeedback(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<IterationRecord<?>> iterationRecord)voidsetup(org.apache.flink.streaming.runtime.tasks.StreamTask<?,?> containingTask, org.apache.flink.streaming.api.graph.StreamConfig config, org.apache.flink.streaming.api.operators.Output<org.apache.flink.streaming.runtime.streamrecord.StreamRecord<IterationRecord<?>>> output)voidsnapshotState(org.apache.flink.runtime.state.StateSnapshotContext context)-
从类继承的方法 org.apache.flink.streaming.api.operators.AbstractStreamOperator
finish, getChainingStrategy, getContainingTask, getCurrentKey, getExecutionConfig, getInternalTimerService, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getTimeServiceManager, getUserCodeClassloader, initializeState, isUsingCustomRawKeyedState, notifyCheckpointComplete, open, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processWatermark, processWatermark1, processWatermark2, processWatermarkStatus, processWatermarkStatus1, processWatermarkStatus2, reportOrForwardLatencyMarker, setChainingStrategy, setCurrentKey, setKeyContextElement1, setKeyContextElement2, setProcessingTimeService, snapshotState
-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
字段详细资料
-
ALIGN_NOTIFY_OUTPUT_TAG
public static final org.apache.flink.util.OutputTag<IterationRecord<Void>> ALIGN_NOTIFY_OUTPUT_TAG
-
-
构造器详细资料
-
HeadOperator
public HeadOperator(IterationID iterationId, int feedbackIndex, boolean isCriteriaStream, org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor, org.apache.flink.runtime.operators.coordination.OperatorEventGateway operatorEventGateway, org.apache.flink.streaming.runtime.tasks.ProcessingTimeService processingTimeService)
-
-
方法详细资料
-
setup
public void setup(org.apache.flink.streaming.runtime.tasks.StreamTask<?,?> containingTask, org.apache.flink.streaming.api.graph.StreamConfig config, org.apache.flink.streaming.api.operators.Output<org.apache.flink.streaming.runtime.streamrecord.StreamRecord<IterationRecord<?>>> output)- 指定者:
setup在接口中org.apache.flink.streaming.api.operators.SetupableStreamOperator<IterationRecord<?>>- 覆盖:
setup在类中org.apache.flink.streaming.api.operators.AbstractStreamOperator<IterationRecord<?>>
-
initializeState
public void initializeState(org.apache.flink.runtime.state.StateInitializationContext context) throws Exception- 指定者:
initializeState在接口中org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator- 覆盖:
initializeState在类中org.apache.flink.streaming.api.operators.AbstractStreamOperator<IterationRecord<?>>- 抛出:
Exception
-
prepareSnapshotPreBarrier
public void prepareSnapshotPreBarrier(long checkpointId) throws Exception- 指定者:
prepareSnapshotPreBarrier在接口中org.apache.flink.streaming.api.operators.StreamOperator<IterationRecord<?>>- 覆盖:
prepareSnapshotPreBarrier在类中org.apache.flink.streaming.api.operators.AbstractStreamOperator<IterationRecord<?>>- 抛出:
Exception
-
snapshotState
public void snapshotState(org.apache.flink.runtime.state.StateSnapshotContext context) throws Exception- 指定者:
snapshotState在接口中org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator- 覆盖:
snapshotState在类中org.apache.flink.streaming.api.operators.AbstractStreamOperator<IterationRecord<?>>- 抛出:
Exception
-
notifyCheckpointAborted
public void notifyCheckpointAborted(long checkpointId) throws Exception- 指定者:
notifyCheckpointAborted在接口中org.apache.flink.api.common.state.CheckpointListener- 覆盖:
notifyCheckpointAborted在类中org.apache.flink.streaming.api.operators.AbstractStreamOperator<IterationRecord<?>>- 抛出:
Exception
-
processElement
public void processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<IterationRecord<?>> element) throws Exception
- 指定者:
processElement在接口中org.apache.flink.streaming.api.operators.Input<IterationRecord<?>>- 抛出:
Exception
-
processFeedback
public void processFeedback(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<IterationRecord<?>> iterationRecord) throws Exception
- 指定者:
processFeedback在接口中org.apache.flink.statefun.flink.core.feedback.FeedbackConsumer<org.apache.flink.streaming.runtime.streamrecord.StreamRecord<IterationRecord<?>>>- 抛出:
Exception
-
handleOperatorEvent
public void handleOperatorEvent(org.apache.flink.runtime.operators.coordination.OperatorEvent operatorEvent)
- 指定者:
handleOperatorEvent在接口中org.apache.flink.runtime.operators.coordination.OperatorEventHandler
-
endInput
public void endInput() throws Exception- 指定者:
endInput在接口中org.apache.flink.streaming.api.operators.BoundedOneInput- 抛出:
Exception
-
close
public void close() throws Exception- 指定者:
close在接口中org.apache.flink.streaming.api.operators.StreamOperator<IterationRecord<?>>- 覆盖:
close在类中org.apache.flink.streaming.api.operators.AbstractStreamOperator<IterationRecord<?>>- 抛出:
Exception
-
getOperatorEventGateway
@VisibleForTesting public org.apache.flink.runtime.operators.coordination.OperatorEventGateway getOperatorEventGateway()
-
getStatus
@VisibleForTesting public org.apache.flink.iteration.operator.HeadOperator.HeadOperatorStatus getStatus()
-
-