PatrickRen commented on code in PR #3186:
URL: https://github.com/apache/flink-cdc/pull/3186#discussion_r1560643635
##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-mysql/src/test/java/org/apache/flink/cdc/connectors/mysql/source/MySqlDataSourceFactoryTest.java:
##########
@@ -79,6 +80,49 @@ public void testNoMatchedTable() {
.hasMessageContaining("Cannot find any table by the option
'tables' = " + tables);
}
+ @Test
+ public void testExcludeTable() {
+ inventoryDatabase.createAndInitialize();
+ Map<String, String> options = new HashMap<>();
+ options.put(HOSTNAME.key(), MYSQL_CONTAINER.getHost());
+ options.put(PORT.key(),
String.valueOf(MYSQL_CONTAINER.getDatabasePort()));
+ options.put(USERNAME.key(), TEST_USER);
+ options.put(PASSWORD.key(), TEST_PASSWORD);
+ // db has three tables , table.list= (products,orders shipments)
+ options.put(TABLES.key(), inventoryDatabase.getDatabaseName() +
".prod\\.*");
+ String tableExcludeList = inventoryDatabase.getDatabaseName() +
".prod\\.orders";
Review Comment:
Here the inclusion pattern is `prod.*`, which matches only one table
`products`. The exclusion pattern is `prod.orders`, which doesn't match any
table, so I'm afraid this case doesn't truly test if the exclusion works as
expected.
What about using `\\.*` for matching all tables in inclusion, and `orders`
for exclusion? The expected output should be `products` and `shipments` after
applying the filter.
##########
docs/content/docs/connectors/mysql.md:
##########
@@ -205,6 +205,16 @@ pipeline:
<td>Integer</td>
<td>The connection pool size.</td>
</tr>
+ <tr>
+ <td>table.exclude.list</td>
Review Comment:
Thanks for the input. With these examples I think it makes sense to support
exclusions.
About the name of the config: what about `tables.exclude`? The value is not
a list but a regex, and using plural form is to align with the option `tables`.
And we need to explain to users about how we apply these filters: match
using `tables` first, then drop tables matches `tables.exclude`.
--
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]