Repository navigation
fix: Kafka subtask reported idle on slow split assignment - #452
Merged
Merged
Conversation
ferenc-csaky
requested changes
Nov 17, 2026
Signed-off-by: Ferenc Csaky <ferenc@datasqrl.com>
ferenc-csaky
approved these changes
Nov 17, 2026
ferenc-csaky
added a commit
that referenced
this pull request
Nov 17, 2026
Signed-off-by: Ferenc Csaky <ferenc@datasqrl.com> Co-authored-by: Ferenc Csaky <ferenc@datasqrl.com>
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 does this change?
Closes #451.
With idle advancement on, a
kafka-safesource subtask could be reported idle while it still had a backlog to read. A temporal join downstream then followed its other input to wall-clock time, and every row of that backlog arrived late. The cause was the reader's main output, which never sees a row: it went idle on its own timeout, before splits were assigned or before an empty split next to a backlog split had gone idle.markActive(), which also turns an idle subtask active when it gets a partition discovered later.InitialAssignmentSignalingEnumeratorwraps the Kafka enumerator, counts the async calls it makes fromstart()and their handlers, and sends each reader anInitialAssignmentDoneEventwhen none is pending. This applies after a restore too.What to look at:
KafkaSourceEnumerator(connector 5.0.0) doing its first assignment incallAsynccalls started fromstart(). If a later version assigned somewhere else, the event would go out early and [BUG] kafka-safe subtask is reported idle at a fresh start while it delivers rows, so a temporal join's clock runs ahead of the backlog #451 would be back for slow enumerators.createMainOutputdoes in Flink 2.3.0.mainit stopped once it was idle.FLINK-40504, on Flink's
release-2.3branch, reports a subtask active from the first row of any split. That does not cover a backlog that has not produced a row yet.Area
flink-sql-runner)connectors)formats)stdlib)env-utils)testing)README.md,stdlib-docs)How did you test it?
kafka-safe-connectorpass on Flink 2.3.0, and with FLINK-40504's classes copied over it.KafkaRecordTimestampWatermarkStrategyTestfail with the main output's rule frommain. They cover a fresh start with a slow enumerator, a subtask without splits, a restored subtask, and a partition discovered later.InitialAssignmentSignalingEnumeratorTestruns the wrapper around the realKafkaSourceEnumerator, without a broker: fresh start, late reader, two restores, periodic discovery and a failed discovery.KafkaSourceWatermarkITpass. The new one runs two source subtasks for one partition, and times out when the reader drops the event.Checklist
feat:,fix:ordocs:, optionally with a scope (e.g.fix(flexible-json):)mvn clean installpasses locally and the code is formatted withmvn spotless:apply(ran:kafka-safe-connectortests,KafkaSourceWatermarkITandspotless:check)given_when_thennaming, AssertJ assertions) (unit tests keep thetest…naming of the existing test classes)pom.xml(none added)git commit -s -S)README.mdandstdlib-docsare updated if user-facing behavior or functions changed🤖 Generated with Claude Code