CodeWithPravinMaske commented on PR #12608: URL: https://github.com/apache/seatunnel/pull/12608#issuecomment-6228999366
Thanks @SEZ9. Short answers with links. All links point to `1d629b844`, the head that was reviewed and approved; the `dev` merge I just pushed only touches `incompatible-changes.md`. **F1/F2 (binlog DDL and table history).** There is no separate "restore" step any more, so there is nothing for those paths to bypass. The fix is in the DDL parser that every path uses. In [`MySqlAntlrDdlParser#parsePrimaryIndexColumnNames`](https://github.com/apache/seatunnel/blob/1d629b84462d825560e431fe7f2eb03caf2a96b5/seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/antlr/MySqlAntlrDdlParser.java#L424-L448), only a real `PRIMARY KEY` forces NOT NULL. Binlog DDL reaches the same parser through [`parseStreamingDdl`](https://github.com/apache/seatunnel/blob/1d629b84462d825560e431fe7f2eb03caf2a96b5/seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/MySqlStreamingChangeEventSource.java#L666), and the checkpointed history stores tables built by that parser. - Tests: [`testNullableUniqueKeyColumnStaysOptionalInStreamingDdl`](https://github.com/apache/seatunnel/blob/1d629b84462d825560e431fe7f2eb03caf2a96b5/seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/test/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/utils/MySqlSchemaTest.java#L217), plus the E2Es that run `ALTER TABLE ... ADD UNIQUE KEY` in the binlog phase ([L420](https://github.com/apache/seatunnel/blob/1d629b84462d825560e431fe7f2eb03caf2a96b5/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/AbstractMysqlCDCITBase.java#L420)), including the savepoint/restore one ([`testMysqlCdcNullInNullableUniqueKeyAfterRestore`](https://github.com/apache/seatunnel/blob/1d629b84462d825560e431fe7f2eb03caf2a96b5/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/AbstractMysqlCDCITBase.java#L431)). **F3 (docs).** [`mergeCatalogTableConfig(Table, CatalogTable)`](https://github.com/apache/seatunnel/blob/1d629b84462d825560e431fe7f2eb03caf2a96b5/seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/utils/CatalogTableUtils.java#L120) only calls `setPrimaryKeyNames` and never touches nullability. The docs line is [`MySQL-CDC.md` L517](https://github.com/apache/seatunnel/blob/1d629b84462d825560e431fe7f2eb03caf2a96b5/docs/en/connectors/source/MySQL-CDC.md?plain=1#L517) (zh at the same place). **F6 (incompatible change).** The entry is in [`incompatible-changes.md`](https://github.com/apache/seatunnel/blob/1d629b84462d825560e431fe7f2eb03caf2a96b5/docs/en/introduction/concepts/incompatible-changes.md?plain=1#L8) (en and zh). It covers sinks that used to receive `0` and now receive NULL, plus the migration steps. After this `dev` sync it sits next to "MySQL CDC Schema-Change Parsing", so new entries added at the top no longer conflict with it. **F4.** [`testNullableColumnConfiguredAsPrimaryKeyEmitsNull`](https://github.com/apache/seatunnel/blob/1d629b84462d825560e431fe7f2eb03caf2a96b5/seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/test/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/utils/MySqlSchemaTest.java#L191) covers exactly that case: `code` is both the table's first (and only) unique key and the column configured in `table-names-config.primaryKeys`. - It builds the catalog table through `CatalogTableUtils.mergeCatalogTableConfig(catalogTable, config)`. - It asserts that the Debezium primary key is `[code]` and that `code` stays optional. - It converts a row with `code = NULL` and asserts the value is NULL, not `0`. - So yes, that case now emits NULL. -- 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]
