[ 
https://issues.apache.org/jira/browse/FLINK-37979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17985220#comment-17985220
 ] 

Sergei Morozov commented on FLINK-37979:
----------------------------------------

I've already submitted a PR for this one: 
[apache/flink-cdc#4048|https://github.com/apache/flink-cdc/pull/4048].

> Obsolete MySQL CDC snapshot split assigner code
> -----------------------------------------------
>
>                 Key: FLINK-37979
>                 URL: https://issues.apache.org/jira/browse/FLINK-37979
>             Project: Flink
>          Issue Type: Technical Debt
>          Components: Flink CDC
>    Affects Versions: cdc-3.4.0
>            Reporter: Sergei Morozov
>            Priority: Minor
>
> There is a redundant condition and a misleading comment in 
> {{MySqlSnapshotSplitAssigner#captureNewlyAddedTables()}} that complicate 
> understanding of the code.
> The condition {{if (AssignerStatus.isAssigningFinished(assignerStatus))}} is 
> evaluated twice in the method in question: once in the very beginning and 
> once closer to the end. This way, the second evaluation will always result in 
> {{true}} and thus is redundant.
> h3. Code Change History
> Prior to FLINK-35859, table discovery would happen in any assigner status, so 
> the condition in the end of the method made sense. Together with adding this 
> condition in the beginning of the method, FLINK-35859 should have removed it 
> from the end.
> h3. What Exactly is Obsolete
> # There is a comment saying "if job is still in snapshot reading phase, 
> directly add all newly added tables". Since FLINK-35859, if the job is still 
> in the snapshot reading phase, this code won't be executed. This comment 
> should be removed as misleading.
> # The second {{if (AssignerStatus.isAssigningFinished(assignerStatus))}} 
> statement. While the {{captureNewlyAddedTables()}} method is running, the 
> assigner status cannot be modified by a different thread because this code is 
> only executed as part of {{MySqlSourceEnumerator#open()}}, i.e. the source in 
> its initialization phase.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to