Skip to content

[FLINK-40077][table-planner] Fix lost NoMoreSplitsEvent masking failure cause in CommonExecSinkITCase#28646

Open
MartijnVisser wants to merge 1 commit into
apache:masterfrom
MartijnVisser:FLINK-40077-testnullenforcer-nomoresplits-race
Open

[FLINK-40077][table-planner] Fix lost NoMoreSplitsEvent masking failure cause in CommonExecSinkITCase#28646
MartijnVisser wants to merge 1 commit into
apache:masterfrom
MartijnVisser:FLINK-40077-testnullenforcer-nomoresplits-race

Conversation

@MartijnVisser

@MartijnVisser MartijnVisser commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What is the purpose of the change

CommonExecSinkITCase.testNullEnforcer is flaky on CI (observed on the AdaptiveScheduler nightly leg, Azure build 76751). The test asserts that the job failure cause chain contains the NOT NULL enforcer message, but intermittently the reported terminal cause is instead FlinkException: An OperatorEvent ... was lost ... Event: '[NoMoreSplitEvent]'.

Root cause: the Source V2 test source emits all rows on the first pollNext, before the coordinator's NoMoreSplitsEvent is delivered. The NOT NULL enforcer then fails the chained Source -> ConstraintEnforcer -> Writer task; the still-in-flight NoMoreSplitsEvent reaches an already-FAILED task and, since it is not loss-tolerant, escalates to a lost-OperatorEvent failover. Under NoRestartBackoffTimeStrategy that failover wins as the reported cause and masks the enforcer error. This race is distinct from FLINK-40011 (which addressed the reader reaching FINISHED before the event arrived); it occurs on the FAILED-task path, which gating END_OF_INPUT alone cannot cover.

The underlying runtime behavior (a lost, non-loss-tolerant coordinator event to an already-failing task superseding the real application failure cause) is a pre-existing general issue tracked separately as FLINK-40078; this PR only removes the race from the test scaffolding.

Brief change log

  • Gate record emission in the test source's pollNext on noMoreSplits, so both coordinator events are delivered before any record is emitted (and thus before the enforcer can fail the task), leaving no coordinator event in flight at failure time. This extends the noMoreSplits gating added in FLINK-40011 from completion to emission.

Verifying this change

This change is a test-stability fix, covered by the existing CommonExecSinkITCase tests.

  • Ran CommonExecSinkITCase#testNullEnforcer 30 times under -Penable-adaptive-scheduler (the failing profile): all green.
  • The other tests in the class that reuse the same source (testStreamRecordTimestampInserter*, testUnifiedSinksAreUsableWithDataStreamSinkProvider, testCharLengthEnforcer, testBinaryLengthEnforcer) still pass, since the enumerator always signals no-more-splits and the rows are still emitted.

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

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (Opus 4.8)

…re cause in CommonExecSinkITCase

The Source V2 test source in CommonExecSinkITCase emits all rows on the
first pollNext call, before the coordinator's NoMoreSplitsEvent has been
delivered. When the NOT NULL enforcer then fails the chained
Source -> ConstraintEnforcer -> Writer task, the still-in-flight
NoMoreSplitsEvent reaches an already-FAILED task and is reported as a
lost OperatorEvent. That failover exception wins as the job's terminal
cause under NoRestartBackoffTimeStrategy and masks the expected enforcer
error, so testNullEnforcer flakily fails its cause assertion.

Gate record emission on the NoMoreSplitsEvent so that both coordinator
events (the split assignment and the no-more-splits signal) are always
delivered before any record is emitted, and thus before the enforcer can
fail the task. This leaves no coordinator event in flight at the moment
of failure and makes the intended enforcer error the only failure cause.

This extends the gating introduced in FLINK-40011, which deferred only
END_OF_INPUT, to record emission as well.

Generated-by: Claude Code (Opus 4.8)
@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

@javi0guerrero4-cloud javi0guerrero4-cloud left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update

@github-actions github-actions Bot added the community-reviewed PR has been reviewed by the community. label Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-reviewed PR has been reviewed by the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants