[FLINK-40499][runtime] Emit ACTIVE before final MAX_WATERMARK at drain - #29037
[FLINK-40499][runtime] Emit ACTIVE before final MAX_WATERMARK at drain#29037MartijnVisser wants to merge 1 commit into
Conversation
|
Not a reviewer on this, just read it closely because it touches a path I've been in. The change looks right to me, I traced the drain path through the valve as it stands on this base (so including #29024): The Which of the two new test classes is the regression test? Minor while you're in there: |
At drain, advanceToEndOfEventTime() emitted Watermark.MAX_WATERMARK directly into the chain output, but RecordWriterOutput and ChainingOutput drop watermarks while the last announced WatermarkStatus is IDLE, so a source that went idle before finishing never delivered the final watermark and downstream event-time timers and windows did not fire. The drain path now emits WatermarkStatus.ACTIVE first (deduplicated downstream when already active). SourceOperatorStreamTask and SourceStreamTask skip the status for tasks deployed as finished, whose FinishedOnRestoreMainOperatorOutput rejects status events; MultipleInputStreamTask needs no such guard because its chained source outputs start ACTIVE and deduplicate the redundant status. Generated-by: Claude Code (Fable 5)
fcbbddd to
be2272f
Compare
|
Updated |
|
@SEPURI-SAI-KRISHNA All three points check out. I've dropped the guard in |
|
Thanks for picking these up. Checked the update: Since dropping the guard was my suggestion I also ran the finished-on-restore paths against LGTM, non-binding. |
What is the purpose of the change
At drain,
advanceToEndOfEventTime()emitsWatermark.MAX_WATERMARKinto the chain output, butRecordWriterOutputandChainingOutputdrop watermarks while the announced status is IDLE. A source that was idle at drain therefore never delivers the final MAX watermark, and downstream event-time timers/windows don't fire. Fix: emitWatermarkStatus.ACTIVEfirst, the same pattern asTimestampsAndWatermarksOperator.WatermarkEmitterandWatermarkAssignerOperator.Brief change log
SourceOperatorStreamTask,SourceStreamTask,MultipleInputStreamTask: emit ACTIVE before MAX_WATERMARK inadvanceToEndOfEventTime(); deduplicated downstream when already active.FinishedOnRestoreMainOperatorOutputrejects status events).MultipleInputStreamTaskneeds no guard: its chained source outputs start ACTIVE, so the redundant status is deduplicated before reachingFinishedOnRestoreInput.SourceOperatorStreamTaskIdleDrainTestandMultipleInputStreamTaskIdleDrainTest(both red without the fix).ChainingOutputIdleMaxWatermarkTestis characterization only: documents the idle gate and the deduplication contract, passes with and without the fix.Verifying this change
SourceOperatorStreamTaskIdleDrainTest: red without the fix (drained output[IDLE, EndOfData], no MAX), green with it.MultipleInputStreamTaskIdleDrainTest: red with theMultipleInputStreamTaskhunk reverted, green with it.SourceOperatorStreamTaskTest,SourceStreamTaskTest,OneInputStreamTaskTest,TwoInputStreamTaskTest,MultipleInputStreamTaskTest,MultipleInputStreamTaskChainedSourcesCheckpointingTest(incl. the finished-on-restore + chained sources drain path).No existing tests modified; all three test classes are new.
Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Fable 5)