[FLINK-40505][runtime] Prune failed subtasks from watermark alignment - #29038
Open
MartijnVisser wants to merge 1 commit into
Open
[FLINK-40505][runtime] Prune failed subtasks from watermark alignment#29038MartijnVisser wants to merge 1 commit into
MartijnVisser wants to merge 1 commit into
Conversation
The per-subtask WatermarkAggregator in SourceCoordinator never removed entries, so a failed subtask's last reported watermark kept constraining maxAllowedWatermark for the whole alignment group after failover. Remove the subtask's watermark in subtaskReset (the per-subtask callback that only fires once no execution attempt is alive) and propagate a changed aggregate to the group-level aggregator; the restarted attempt re-registers itself with its next ReportedWatermarkEvent. The updated maxAllowedWatermark reaches subtasks via the existing periodic announceCombinedWatermark, so no immediate announcement is needed. Generated-by: Claude Code (Fable 5)
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Fixes FLINK-40505:
SourceCoordinatornever removed a subtask's last reported watermark from the watermark-alignment aggregation. After a subtask failure and reset, the stale entry kept constrainingmaxAllowedWatermarkfor the entire alignment group until the restarted subtask happened to report again — and indefinitely if it never did (e.g. after downscale). The retained value is not a conservative bound either: a restarted attempt can resume from an earlier checkpoint position than its last report.Brief change log
WatermarkAggregator#remove(key), returning the new aggregated watermark iff the aggregate changed.SourceCoordinator#subtaskResetnow removes the failed subtask's watermark and, when the per-source aggregate changed, propagates it to the group-level aggregator in the coordinator store via the same update path used for reported watermarks (extracted asupdateAggregatedWatermarkOfGroup).subtaskReset(per-subtask, fires only when no execution attempt is alive) rather than per-attemptexecutionAttemptFailed: watermark alignment is mutually exclusive with concurrent execution attempts (enforced in the constructor and inhandleReportedWatermark), and global failover recreates the coordinator. Subtasks pick up the updatedmaxAllowedWatermarkvia the existing periodicannounceCombinedWatermark.Known follow-up (out of scope here): the group-level aggregator in the coordinator store never removes an
operatorNameentry, so a permanently stopped source in a multi-source alignment group is still never pruned.Verifying this change
This change added tests and can be verified as follows:
SourceCoordinatorAlignmentTest#testWatermarkAlignmentStatePrunedAfterSubtaskFailureAndResetfails without the fix (announcedmaxAllowedWatermarkstayed 1100 from the stale entry; expected 1200 after the constraining subtask fails and resets) and passes with it.testSubtaskThatNeverReportedReceivesNoAlignmentEventsdocuments that only subtasks that have reported receive alignment events.SourceCoordinatorAlignmentTest,SourceCoordinatorTest, andSourceCoordinatorContextTestall pass locally.Both new tests are additive; no existing tests were modified.
Does this pull request potentially affect one of the following parts:
@Public(Evolving): noSourceCoordinatorbehavior on subtask reset during partial failoverDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Fable 5)