CodeWithPravinMaske commented on PR #12608:
URL: https://github.com/apache/seatunnel/pull/12608#issuecomment-5989684924

   Thanks @SEZ9! Sorry for the confusion: my first reply went out before the 
reworked code was on the branch. It is pushed now (226cdde90), and the branch 
is merged with the latest `dev`.
   
   1. **Code and tests.** The override is 
`seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/antlr/MySqlAntlrDdlParser.java`,
 a copy of Debezium 1.9.8 where only `parsePrimaryIndexColumnNames` changes. 
Tests:
      - 
`MySqlSchemaTest#testNullableUniqueKeyColumnStaysOptionalInStreamingDdl`: 
through `MySqlDatabaseSchema#parseStreamingDdl` (the binlog reader's path), 
`CREATE TABLE` + `ALTER TABLE ... ADD UNIQUE KEY` and `CREATE UNIQUE INDEX` 
keep the column optional, while it is still promoted to the key.
      - `testRealPrimaryKeyColumnIsNotOptionalInStreamingDdl`: a real primary 
key (table constraint and `ALTER TABLE ... ADD PRIMARY KEY`) stays NOT NULL.
      - The existing snapshot tests (single and composite unique key) now go 
through the same parser.
      - E2E `testMysqlCdcNullInNullableUniqueKeyWithoutPrimaryKey`: the new 
`uk_added_null` table gets `ALTER TABLE ... ADD UNIQUE KEY` in the binlog 
phase, then a NULL insert, and the sink must hold NULL and no `0`. `MysqlCDCIT` 
passes locally.
      - Restore: the table history saved in a checkpoint is the `TableChange` 
built by this parser, so it now carries the declared nullability. I did not add 
a savepoint/restore E2E; I can add one if you think it's needed. A checkpoint 
taken by an older version that already holds such a table keeps the old schema; 
this is documented in `incompatible-changes.md`.
   2. **`restoreNullableColumns`**: removed completely. `MySqlSchema.java` is 
identical to `dev` again, so the guard, the Javadoc and the per-column log are 
gone.
   3. **Docs**: added an `incompatible-changes.md` entry and a MySQL-CDC docs 
note (en and zh). For a nullable column in `table-names-config.primaryKeys`: 
the parser keeps the column's declared nullability, and 
`CatalogTableUtils#mergeCatalogTableConfig` only overrides the key names, so 
NULL is emitted as NULL there too. The docs say so and recommend a NOT NULL 
column when UPDATE/DELETE must be applied by key.
   


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