mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
添加Rows过滤
This commit is contained in:
@@ -84,6 +84,8 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar
|
|||||||
private boolean filterQueryDdl = false;
|
private boolean filterQueryDdl = false;
|
||||||
// 是否跳过table相关的解析异常,比如表不存在或者列数量不匹配,issue 92
|
// 是否跳过table相关的解析异常,比如表不存在或者列数量不匹配,issue 92
|
||||||
private boolean filterTableError = false;
|
private boolean filterTableError = false;
|
||||||
|
// 新增rows过滤,用于仅订阅除rows以外的数据
|
||||||
|
private boolean filterRows = false;
|
||||||
|
|
||||||
public Entry parse(LogEvent logEvent) throws CanalParseException {
|
public Entry parse(LogEvent logEvent) throws CanalParseException {
|
||||||
if (logEvent == null || logEvent instanceof UnknownLogEvent) {
|
if (logEvent == null || logEvent instanceof UnknownLogEvent) {
|
||||||
@@ -305,7 +307,7 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Entry parseRowsEvent(RowsLogEvent event) {
|
private Entry parseRowsEvent(RowsLogEvent event) {
|
||||||
if (filterQueryDml) {
|
if (filterRows) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -716,5 +718,9 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar
|
|||||||
public void setFilterTableError(boolean filterTableError) {
|
public void setFilterTableError(boolean filterTableError) {
|
||||||
this.filterTableError = filterTableError;
|
this.filterTableError = filterTableError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFilterRows(boolean filterRows) {
|
||||||
|
this.filterRows = filterRows;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user