alibaba / canal

阿里巴巴 MySQL binlog 增量订阅&消费组件
Apache License 2.0
28.55k stars 7.62k forks source link

canal解析DDL语句报错 #5304

Open wangcool opened 1 month ago

wangcool commented 1 month ago

canal 版本:1.1.4 mysql版本:5.7.28

Question

2024-10-23 10:50:10.788 [destination = shuzi-binlog , address = /11.28.20.200:3306 , EventParser] WARN c.a.otter.canal.parse.inbound.mysql.tsdb.MemoryTableMeta - parse faield : / Create table in target / CREATE TABLE loan_debt( ORDER_NO varchar(19) COLLATE utf8_general_ci NOT NULL COMMENT '借据号' , CUST_NO varchar(19) COLLATE utf8_general_ci NOT NULL COMMENT '客户号' , PROD_SUB_NO varchar(6) COLLATE utf8_general_ci NOT NULL COMMENT '产品号' , CAPITAL_SOURCE varchar(10) COLLATE utf8_general_ci NOT NULL COMMENT '来源' , PACKAGE_DATE int(8) NOT NULL DEFAULT '0' COMMENT '封包日期' , DEBT_DATE int(8) NOT NULL DEFAULT '0' COMMENT '债转日期' , ACCOUNT_TREATMENT_STATUS char(1) COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '是否账务处理,1-是;0-否,默认否' , ACCOUNT_TREATMENT_DATE int(8) NOT NULL DEFAULT '0' COMMENT '账务处理日期' , BD_CREATE_DATETIME timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间' , BD_UPDATE_DATETIME timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间' , DW_ID bigint(20) unsigned NOT NULL auto_increment COMMENT '自增id' , DW_TIME timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '时间戳' , IS_DELETE tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '数据逻辑删除字段' , PROMPT_DATE int(8) NULL COMMENT '交割日期' , PRIMARY KEY (ORDER_NO) , UNIQUE KEY DW_ID_UNIQUE(DW_ID) , KEY IDX_ACCOUNT_TREATMENT_DATE(ACCOUNT_TREATMENT_DATE) ) ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='借据表' com.alibaba.fastsql.sql.parser.ParserException: syntax error, error in :'TAMP on update CURRENT_TIMESTAMP CO', expect ), actual ON, pos 871, line 12, column 99, token ON at com.alibaba.fastsql.sql.parser.SQLParser.printError(SQLParser.java:430) ~[fastsql-2.0.0_preview_973.jar:2.0.0_preview_973] at com.alibaba.fastsql.sql.parser.SQLParser.accept(SQLParser.java:438) ~[fastsql-2.0.0_preview_973.jar:2.0.0_preview_973] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlCreateTableParser.parseCreateTable(MySqlCreateTableParser.java:358) ~[fastsql-2.0.0_preview_973.jar:2.0.0_preview_973] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlStatementParser.parseCreate(MySqlStatementParser.java:291) ~[fastsql-2.0.0_preview_973.jar:2.0.0_preview_973] at com.alibaba.fastsql.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:231) ~[fastsql-2.0.0_preview_973.jar:2.0.0_preview_973] at com.alibaba.fastsql.sql.SQLUtils.parseStatements(SQLUtils.java:536) ~[fastsql-2.0.0_preview_973.jar:2.0.0_preview_973] at com.alibaba.fastsql.sql.repository.SchemaRepository.console(SchemaRepository.java:439) ~[fastsql-2.0.0_preview_973.jar:2.0.0_preview_973] at com.alibaba.otter.canal.parse.inbound.mysql.tsdb.MemoryTableMeta.apply(MemoryTableMeta.java:83) ~[canal.parse-1.1.4.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.tsdb.DatabaseTableMeta.applyHistoryOnMemory(DatabaseTableMeta.java:465) [canal.parse-1.1.4.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.tsdb.DatabaseTableMeta.rollback(DatabaseTableMeta.java:176) [canal.parse-1.1.4.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.AbstractMysqlEventParser.processTableMeta(AbstractMysqlEventParser.java:137) [canal.parse-1.1.4.jar:na] at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:200) [canal.parse-1.1.4.jar:na] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_242] 2024-10-23 10:50:10.788 [destination = shuzi-binlog , address = /11.28.20.200:3306 , EventParser] WARN c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - ---> find start position successfully, EntryPosition[included=false,journalName=3306-binlog.000328,position=41492,serverId=125,gtid=,timestamp=1729651782000] cost : 105ms , the next step is binlog dump 2024-10-23 10:51:31.225 [canal-instance-scan-0] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - stop CannalInstance for null-shuzi-binlog 2024-10-23 10:51:31.461 [canal-instance-scan-0] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - stop successful....

dyrnq commented 1 month ago
CREATE TABLE loan_debt(
ORDER_NO varchar(19) COLLATE utf8_general_ci NOT NULL COMMENT '借据号' ,
CUST_NO varchar(19) COLLATE utf8_general_ci NOT NULL COMMENT '客户号' ,
PROD_SUB_NO varchar(6) COLLATE utf8_general_ci NOT NULL COMMENT '产品号' ,
CAPITAL_SOURCE varchar(10) COLLATE utf8_general_ci NOT NULL COMMENT '来源' ,
PACKAGE_DATE int(8) NOT NULL DEFAULT '0' COMMENT '封包日期' ,
DEBT_DATE int(8) NOT NULL DEFAULT '0' COMMENT '债转日期' ,
ACCOUNT_TREATMENT_STATUS char(1) COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '是否账务处理,1-是;0-否,默认否' ,
ACCOUNT_TREATMENT_DATE int(8) NOT NULL DEFAULT '0' COMMENT '账务处理日期' ,
BD_CREATE_DATETIME timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间' ,
BD_UPDATE_DATETIME timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间' ,
DW_ID bigint(20) unsigned NOT NULL auto_increment COMMENT '自增id' ,
DW_TIME timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '时间戳' ,
IS_DELETE tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '数据逻辑删除字段' ,
PROMPT_DATE int(8) NULL COMMENT '交割日期' ,
PRIMARY KEY (ORDER_NO) ,
UNIQUE KEY DW_ID_UNIQUE(DW_ID) ,
KEY IDX_ACCOUNT_TREATMENT_DATE(ACCOUNT_TREATMENT_DATE)
) ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='借据表'

看下你的这个语句 BD_UPDATE_DATETIME 和 DW_TIME 两列的分别各自有两个on update,是不是重复了?