chengcongchina commented on code in PR #4302:
URL: https://github.com/apache/flink-cdc/pull/4302#discussion_r3212675546
##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/io/debezium/connector/mysql/MySqlStreamingChangeEventSource.java:
##########
@@ -1350,6 +1363,15 @@ protected void initSSLContext(SSLContext sc) throws
GeneralSecurityException {
return null;
}
+ private TableIdFilter getTableIdDeserializationFilter() {
+ return tableId -> {
+ // since only subscribed table is recording schema, the result
could be null
+ TableId table = taskContext.getSchema().getTableId(tableId);
+ return table != null
+ &&
connectorConfig.getTableFilters().dataCollectionFilter().isIncluded(table);
Review Comment:
@lvyanquan Good point. With the current Debezium MySqlDatabaseSchema
behavior, `taskContext.getSchema().getTableId(tableNumber)` returns non-null
only when the
table mapping was assigned for a known table schema, so `table != null` is
effectively enough to exclude unsubscribed tables today.
That said, I’m keeping the additional
`connectorConfig.getTableFilters().dataCollectionFilter().isIncluded(table)`
check intentionally as a defensive guard. The `getTableId(tableNumber)` API
itself doesn’t formally guarantee that null always means
“unsubscribed/unmatched”, it’s just how the current implementation behaves (it
depends on how schema/history is populated). If schema/history handling changes
in the future (e.g., more tables’ schemas are present/loaded than the
subscribed set), getTableId() could become non-null for tables we still don’t
want to deserialize. The explicit `isIncluded(table)` keeps the intent (“only
deserialize captured tables”) robust against such evolution.
--
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]