Purushottam Sinha created FLINK-41644:
-----------------------------------------

             Summary: [mysql] Snapshot-only source can fail at the end of the 
snapshot: IsProcessingBacklogEvent sent to a finished reader
                 Key: FLINK-41644
                 URL: https://issues.apache.org/jira/browse/FLINK-41644
             Project: Flink
          Issue Type: Bug
          Components: Flink CDC
    Affects Versions: cdc-3.7.0, cdc-3.4.0, cdc-3.6.0, cdc-3.3.0, cdc-3.5.0
            Reporter: Purushottam Sinha


h3. Problem
A MySQL CDC source with {{scan.startup.mode: snapshot}} and parallelism above 1 
intermittently fails one of its readers when the snapshot ends. With restarts 
off the job fails; with restarts on it fails over needlessly.
{noformat}
FlinkException: An OperatorEvent from an OperatorCoordinator to a task was 
lost. Triggering task failover to ensure consistency. Event: 'BacklogEvent 
(backlog='false')', targetTask: ...
Caused by: TaskNotRunningException: Task is not running, but in state FINISHED
{noformat}

h3. Cause
* Since FLINK-36811 (cdc-3.3.0), 
{{MySqlSnapshotSplitAssigner#onFinishedSplits}} calls 
{{setIsProcessingBacklog(false)}} once all snapshot splits are finished, and 
Flink sends {{IsProcessingBacklogEvent}} to every reader.
* In snapshot-only mode a reader finishes after its last split. If its task has 
finished when the event arrives but the JobManager has not yet processed its 
FINISHED state, Flink fails the task, because {{IsProcessingBacklogEvent}} is 
not loss tolerant.

h3. Evidence
* Repeating the {{UdfE2eITCase}} case (java, batch, parallelism 4) on GitHub 
runners: 14 of 500 runs failed with the exception above (FLINK-41608). In all 
14, the reader's task had finished 20-50 ms before the event arrived.

h3. Proposed fix
* Don't report backlog from a snapshot-only source, as before FLINK-36811. With 
this change, 0 of 500 runs failed.
* Trade-off: snapshot-only jobs in streaming mode no longer use 
{{execution.checkpointing.interval-during-backlog}} while they read.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to