FlatMessage没有默认构造方法json反序列化的问题

Dml类增加isDdl属性
This commit is contained in:
mcy
2018-12-17 09:47:09 +08:00
parent 3acdffb297
commit 833cc55e26
5 changed files with 15 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ public class Dml implements Serializable {
private String database; // 数据库或schema
private String table; // 表名
private List<String> pkNames;
private Boolean isDdl;
private String type; // 类型: INSERT UPDATE DELETE
// binlog executeTime
private Long es; // 执行耗时
@@ -59,6 +60,14 @@ public class Dml implements Serializable {
this.pkNames = pkNames;
}
public Boolean getIsDdl() {
return isDdl;
}
public void setIsDdl(Boolean isDdl) {
this.isDdl = isDdl;
}
public String getType() {
return type;
}

View File

@@ -139,6 +139,7 @@ public class MessageUtil {
dml.setDatabase(flatMessage.getDatabase());
dml.setTable(flatMessage.getTable());
dml.setPkNames(flatMessage.getPkNames());
dml.setIsDdl(flatMessage.getIsDdl());
dml.setType(flatMessage.getType());
dml.setTs(flatMessage.getTs());
dml.setEs(flatMessage.getEs());

View File

@@ -56,7 +56,7 @@ public class RdbMirrorDbSyncService {
if (mirrorDbConfig == null) {
continue;
}
if (StringUtils.isNotEmpty(dml.getSql())) {
if (dml.getIsDdl() != null && dml.getIsDdl() && StringUtils.isNotEmpty(dml.getSql())) {
// DDL
if (logger.isDebugEnabled()) {
logger.debug("DDL: {}", JSON.toJSONString(dml, SerializerFeature.WriteMapNullValue));

View File

@@ -135,7 +135,7 @@ public class RdbSyncService {
public void sync(Map<String, Map<String, MappingConfig>> mappingConfig, List<Dml> dmls) {
try {
sync(dmls, dml -> {
if (StringUtils.isNotEmpty(dml.getSql())) {
if (dml.getIsDdl() != null && dml.getIsDdl() && StringUtils.isNotEmpty(dml.getSql())) {
// DDL
columnsTypeCache.remove(dml.getDestination() + "." + dml.getDatabase() + "." + dml.getTable());
return false;

View File

@@ -29,6 +29,9 @@ public class FlatMessage implements Serializable {
private List<Map<String, String>> data;
private List<Map<String, String>> old;
public FlatMessage() {
}
public FlatMessage(long id){
this.id = id;
}