Skip to content

[BP-2.3][FLINK-39481][task] Execute deferrable mails when finishing an operator#28648

Merged
MartijnVisser merged 2 commits into
apache:release-2.3from
MartijnVisser:FLINK-39481-2.3
Jul 6, 2026
Merged

[BP-2.3][FLINK-39481][task] Execute deferrable mails when finishing an operator#28648
MartijnVisser merged 2 commits into
apache:release-2.3from
MartijnVisser:FLINK-39481-2.3

Conversation

@MartijnVisser

Copy link
Copy Markdown
Contributor

What is the purpose of the change

Backport of #28608 to release-2.3.

An interrupted timer-firing chain defers its continuation (and the downstream watermark emission) to a deferrable mail. The operator-finish drain skipped deferrable mails, so EndOfData could overtake the deferred watermark and downstream operators never received it, losing the state of windows that only fire on it (FLINK-39481, observed as WindowDistinctAggregateITCase exactly-once data loss after restore).

The fix executes deferrable mails when finishing an operator.

Brief change log

Clean cherry-pick of 83055ae and bbc688c from master.

Verifying this change

StreamOperatorWrapperTest, MailboxExecutorImplTest and UnalignedCheckpointsInterruptibleTimersTest (including the new testDeferredWatermarkIsEmittedBeforeEndOfData, the red-green test for this fix) pass on this branch. WindowDistinctAggregateStressITCase is included in the cherry-pick and is validated by CI.

Does this pull request potentially affect one of the following parts:

Same as #28608: no dependencies, no public API, no serializers, no per-record code paths; touches the operator-finish path of the task lifecycle.

Documentation

  • Does this pull request introduce a new feature? no

Was generative AI tooling used to co-author this PR?
  • Yes (Claude Fable 5)

Generated-by: Claude Fable 5

Since FLINK-35528 the continuation mail of an interrupted timer-firing chain
is deferrable and hidden from tryYield(). The finish drain in
StreamOperatorWrapper therefore skipped it, so a task reaching end of input
mid-firing forwarded EndOfData before the pending watermark, and downstream
operators discarded the state of windows that only fire on that watermark.
Restore the pre-FLINK-35528 behaviour by draining with a new yield variant
that matches deferrable mails by their original priority, used only in that
place.

Generated-by: Claude Code (Fable 5)
(cherry picked from commit 83055ae)
… of input

Exercises the full SQL pipeline (two-phase split-distinct window aggregation
on RocksDB) under backpressure with the configuration in which all CI
failures of WindowDistinctAggregateITCase occurred, comparing repeated
checkpoint/failure/restore/end-of-input rounds against a golden run within a
fixed time budget. Without the FLINK-39481 fix this loses the trailing
window family in roughly one of three executions.

Generated-by: Claude Code (Fable 5)
(cherry picked from commit bbc688c)
@flinkbot

flinkbot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@MartijnVisser MartijnVisser merged commit fcd20f2 into apache:release-2.3 Jul 6, 2026
@MartijnVisser MartijnVisser deleted the FLINK-39481-2.3 branch July 6, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants