[cdc-common] Introduce CollectionFilter to filter collection from given TableId pattern#2673
Conversation
f663527 to
acb6c37
Compare
leonardBang
left a comment
There was a problem hiding this comment.
Thanks @GOODBOY008 for the contribution ,could you add some implementation classes and corresponding tests as well?
bfca0bf to
087fc75
Compare
Jiabao-Sun
left a comment
There was a problem hiding this comment.
Thanks @GOODBOY008 for this great work.
I left some comments.
5a22681 to
1589ed7
Compare
| assertNotAllowed(filter, "db2", "sc1", "A2"); | ||
|
|
||
| // schemaName, tableName | ||
| filter = Selectors.tableSelector().includeTables("sc1\\.A[0-9]+,sc2\\.B[0-1]+").build(); |
There was a problem hiding this comment.
@GOODBOY008 @Jiabao-Sun Could we use "sc1.A[0-9]+,sc2.B[0-1]+" here? I mean if . is part of regex pattern and then we use sc1.A\\.*,sc2.B\\.*.
There was a problem hiding this comment.
The most common case for entire database sync should be mydb.users, mydb.orders, which is better than mydb\\.users, mydb\\.orders
There was a problem hiding this comment.
sc1.A[0-9]+ can be matched to sc1.a1 and sc1.a2, because . can match any character.
Write mydb.users and mydb.orders directly that can match the corresponding table, but if there is no db constraint, there may be side effects: mydb_orders, mydb-orders ...
There was a problem hiding this comment.
We can use \. if . is one part of regex pattern just like we treats ,, , can be part of a regex pattern
There was a problem hiding this comment.
I mean we can follow same rule and offer a more elegant table id pattern
| private static TableId getTableId(String nameSpace, String schemaName, String tableName) { | ||
| TableId id; | ||
| if (nameSpace == null && schemaName == null) { | ||
| id = TableId.tableId(tableName); |
There was a problem hiding this comment.
could we also add test for this kind of table.
0a3234c to
2cc7e88
Compare
…en TableId pattern
2cc7e88 to
8c9d905
Compare
leonardBang
left a comment
There was a problem hiding this comment.
Thanks @GOODBOY008 for the update, the updated PR especially the tests looks good to me.
… TableId pattern (apache#2673) This closes apache#2669.
… TableId pattern (apache#2673) This closes apache#2669.
Close #2669
[cdc-common] Introduce CollectionFilter to filter collection from given TableId pattern