diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadAction.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadAction.java index 9f63403f..48777b3b 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadAction.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadAction.java @@ -366,7 +366,14 @@ public Boolean doInStatement(Statement stmt) throws SQLException, DataAccessExce // 解决当数据库名称为关键字如"Order"的时候,会报错,无法同步 result &= stmt.execute("use `" + data.getDdlSchemaName() + "`"); } - result &= stmt.execute(data.getSql()); + // 跳过删除表时目标库无此表报错 + String sql = data.getSql(); + if (dbDialect instanceof MysqlDialect) { + if (sql.startsWith("DROP TABLE `")) { + sql = "DROP TABLE IF EXISTS" + sql.substring(10); + } + } + result &= stmt.execute(sql); return result; } }); diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageParser.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageParser.java index c405d41d..9711015c 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageParser.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageParser.java @@ -588,8 +588,12 @@ private EventData internParse(Pipeline pipeline, Entry entry, RowChange rowChang // eventData.setKeys(columns); // } } else { - throw new SelectException("this rowdata has no pks , entry: " + entry.toString() + " and rowData: " - + rowData); +// throw new SelectException("this rowdata has no pks , entry: " + entry.toString() + " and rowData: " +// + rowData); + if (logger.isWarnEnabled()) { + logger.warn("this rowdata has no pks ,schemaName={},tableName={}", eventData.getSchemaName(), eventData.getTableName()); + } + return null; } return eventData;