rkhachatryan commented on code in PR #29954:
URL: https://github.com/apache/flink/pull/29954#discussion_r4684968383
##########
flink-runtime/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java:
##########
@@ -1888,7 +1894,18 @@ private void tryShutdownTimerService(long timeoutMs,
TimerService timerService)
public void dispatchOperatorEvent(OperatorID operator,
SerializedValue<OperatorEvent> event)
throws FlinkException {
try {
+ // Operator events must be urgent: the coordinator considers an
event delivered once it
+ // is enqueued here, and it may then take a checkpoint that must
include the event's
+ // effect (e.g. AddSplitEvent). Unaligned checkpoint triggers are
urgent mails (see
+ // triggerCheckpointAsync), so a normal mail could be overtaken by
the trigger. Urgent
+ // mails are executed in FIFO order among themselves
(TaskMailboxImpl keeps them in a
+ // dedicated FIFO urgent queue served before the batch; both mails
are put with the
+ // same priority), which preserves the ordering.
+ // This is also safe for an aligned trigger (a normal mail): the
coordinator's gateway
+ // stays closed from its checkpoint until the task's
AcknowledgeCheckpointEvent, which
+ // is sent after the task-side snapshot, so later events can't
overtake the snapshot.
mainMailboxExecutor.execute(
+ MailboxExecutor.MailOptions.urgent(),
() -> operatorChain.dispatchOperatorEvent(operator, event),
Review Comment:
Yes, this is intended. Events stay FIFO among themselves (all urgent), and
they're still handled before any checkpoint the coordinator takes after sending
them. Their ordering against timers or the operator's own mails was never
guaranteed: the coordinator can't observe those.
The one observable change is against checkpoint notifications. JM notifies
tasks before coordinators (CheckpointCoordinator#sendAcknowledgeMessages), so
an event sent from OperatorCoordinator#notifyCheckpointComplete may now be
handled before the operator's own
notifyCheckpointComplete. I considered making checkpoint notifications
urgent too but decided against it: they can be slow (commits), so they'd delay
UC triggers and also overtake the operator's own pending mails.
Documented in 84096262728a (OperatorEventHandler#handleOperatorEvent) and
6c4664868189 (StreamTask#dispatchOperatorEvent). I'll also add a release note
to FLINK-41442.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]