-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
增加表字段过滤功能 #1914
增加表字段过滤功能 #1914
Conversation
|
Codecov Report
@@ Coverage Diff @@
## master #1914 +/- ##
========================================
Coverage ? 5.31%
Complexity ? 126
========================================
Files ? 265
Lines ? 23944
Branches ? 3510
========================================
Hits ? 1272
Misses ? 22460
Partials ? 212
Continue to review full report at Codecov.
|
需要字段过滤的主要业务场景是啥?想了解一下 |
比如我要同步新闻表 也就是说 我在乎的是某一条数据的变化,但不在乎他具体变成什么样了,因为后面还有业务逻辑来处理 |
canal.instance.filter.field=test1.t_product=id/subject/keywords,test2.t_company=id/name/contact/ch 能按照冒号来分隔表和列的关系,例子: 还有类似黑名单列的例子: 可以按照完整功能的方式来做支持 |
tks |
instance增加配置
canal.instance.filter.field
schema1.tableName1:field1/field2,schema2.tableName2:field1/field2
test1.t_product:id/subject/keywords,test2.t_company:id/name/contact/ch
canal.instance.filter.black.field
schema1.tableName1:field1/field2,schema2.tableName2:field1/field2
test1.t_product:subject/product_image,test2.t_company:id/name/contact/ch
冲突时以白名单为准
spring/xxx-instance增加
<property name="fieldFilter" value="${canal.instance.filter.field}" />
<property name="fieldBlackFilter" value="${canal.instance.filter.black.field}" />
实现
com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert
行解析中对字段名进行判断,不符合条件的不加入rowDataBuilder