spuru9 opened a new pull request, #4634:
URL: https://github.com/apache/flink-cdc/pull/4634

   ## What is the purpose of this pull request?
   
   Fixes [FLINK-41644](https://issues.apache.org/jira/browse/FLINK-41644), the 
cause of the intermittent `UdfE2eITCase` (java, batch) failure in 
[FLINK-41608](https://issues.apache.org/jira/browse/FLINK-41608).
   
   Since FLINK-36811 (cdc-3.3.0), the MySQL source reports that it is 
processing backlog during the snapshot, and once all snapshot splits are 
finished it sends `IsProcessingBacklogEvent(false)` to every reader. In 
snapshot-only mode the readers finish with the snapshot, so that event can 
reach a reader whose task has just finished, before the JobManager has 
processed its FINISHED state. The event is not loss tolerant, so Flink fails 
the reader:
   
   ```
   FlinkException: An OperatorEvent from an OperatorCoordinator to a task was 
lost. Triggering task failover to ensure consistency. Event: 'BacklogEvent 
(backlog='false')', ...
   Caused by: TaskNotRunningException: Task is not running, but in state 
FINISHED
   ```
   
   With restarts off the job fails. Any MySQL source with `scan.startup.mode: 
snapshot` and parallelism above 1 can hit it.
   
   ## Brief change log
   
   - A snapshot-only MySQL source no longer reports backlog, as before 
FLINK-36811. Dropping only the final `false` would leave the backlog flag set 
after the snapshot, and the final checkpoint would wait for 
`execution.checkpointing.interval-during-backlog`.
   - `MockMySqlSplitEnumeratorEnumeratorContext` records every backlog update; 
`testSnapshotOnlyModeDoesNotSetProcessingBacklog` checks that a snapshot-only 
assigner makes none.
   
   Trade-off: snapshot-only jobs in streaming mode no longer use 
`execution.checkpointing.interval-during-backlog` while they read. Flink could 
also make `IsProcessingBacklogEvent` loss tolerant, as FLINK-37670 did for 
`WatermarkAlignmentEvent`, but that would only help new Flink releases.
   
   ---
   
   ## Verifying this change
   
   - `testSnapshotOnlyModeDoesNotSetProcessingBacklog` fails without the fix 
(`Expecting empty but was: [true, false]`) and passes with it; 
`MySqlHybridSplitAssignerTest` and `MySqlSnapshotSplitAssignerTest` pass (31 
tests).
   - On GitHub runners (ubuntu-22.04, JDK 11, Flink 2.2.0), 20 jobs × 25 runs 
of the failing case (java, batch, parallelism 4): 14 of 500 failed with the 
exception above without the fix 
([run](https://github.com/spuru9/flink-cdc/actions/runs/45117759849)), 0 of 500 
with it ([run](https://github.com/spuru9/flink-cdc/actions/runs/45365408134)).
   
   ## 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?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Claude Opus 5.5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to