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

   ## Purpose
   
   MySQL treats `CREATE TABLE IF NOT EXISTS target_table LIKE template_table` 
as a no-op when `target_table` already exists. The MySQL Pipeline connector 
currently lets both the Debezium create-table listener and the Flink CDC custom 
listener process the copy-table statement. The Debezium listener updates the 
shared table cache before the custom listener can determine that MySQL did not 
create anything.
   
   If the existing target and template have different column layouts, the 
cached target schema is replaced with the template schema. A later row event 
can then be decoded against the wrong column order or types, even though the 
physical MySQL target table never changed.
   
   ## Changes
   
   - Keep regular `CREATE TABLE` handling in the Debezium-derived listener, 
while making the Flink CDC custom listener the single owner of `CREATE TABLE 
... LIKE` processing.
   - Preserve the cached target schema and emit no schema event when `IF NOT 
EXISTS` is present and the target table is already known.
   - Preserve the existing copy behavior when the target table does not exist.
   - Add regression coverage for both the no-op and normal copy cases.
   
   ## Verification
   
   ```text
   CustomMySqlAntlrDdlParserTest: 2 tests, 0 failures, 0 errors
   ```
   
   The tests pass on both Flink CDC 3.6.0 and the current `master` branch. A 
Jira issue will be linked before this pull request is marked ready for review.


-- 
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