canal.instance.tsdb.enable=false 是否和表结构中 UNIQUE KEY uniqueid (uniqueid) USING BTREE 有关? 我断点调试发现ddl语句这段是这样的:UNIQUE KEY uniqueid
(uniqueid) USING BTREE。 MySqlExprParser.java 863行 if (lexer.token() != Token.LPAREN) { //获取的索引名字是 ``,此时的token 变成了 uniqueid SQLName indexName = name(); unique.setName(indexName); }
875行 parseIndexRest(unique);
SQLExprParser.java 4108行 accept(Token.LPAREN); //执行到此处的时候token不相等了 if (lexer.token == token) { lexer.nextToken(); } else { throw new ParserException("syntax error, expect " + (token.name != null ? token.name : token.toString()) + ", actual " + (lexer.token.name != null ? lexer.token.name : lexer.token.toString()) + " " + lexer.info()); }
原因是唯一索引的名字是:uniqueid``
WARN c.a.otter.canal.parse.inbound.mysql.tsdb.MemoryTableMeta - parse faield : CREATE TABLE zh201812 ( id bigint(20) NOT NULL AUTO_INCREMENT, user_id bigint(20) DEFAULT NULL COMMENT '拨打人', organ_id bigint(20) DEFAULT NULL COMMENT '部门', src varchar(128) DEFAULT NULL COMMENT '主叫号码', dst varchar(128) DEFAULT NULL COMMENT '被叫号码', record varchar(256) CHARACTER SET latin1 DEFAULT NULL COMMENT '录音文件路径(如http:// requestUrl/monitor/ out--8001-20170222-150804-1487747284.69.wav)', uniqueid varchar(128) DEFAULT NULL COMMENT 'ZcallrCC对本次通话的唯一ID号(如1487575283.1019)', route varchar(128) CHARACTER SET latin1 DEFAULT NULL COMMENT '路由编号', cid varchar(128) CHARACTER SET latin1 DEFAULT NULL COMMENT '呼入时来电的线路号码', location varchar(128) DEFAULT NULL COMMENT '归属地(省/市,中间用/分隔)', uid varchar(128) CHARACTER SET latin1 DEFAULT NULL COMMENT '请求唯一id号,甲方提供,为了与甲方系统唯一关联', starttime datetime DEFAULT NULL COMMENT '呼叫发起时间', endtime datetime DEFAULT NULL COMMENT '呼叫结束时间', dialingtime datetime DEFAULT NULL COMMENT '开始呼叫分机时间', calltime datetime DEFAULT NULL COMMENT '开始通话时间', dialingsec int(11) DEFAULT NULL COMMENT '振铃时长(秒)(从开始呼叫分机或外部电话到开始通话之间的时长)', callsec int(11) DEFAULT NULL COMMENT '通话时长(秒)(从开始通话到结束通话之间的时长)', durationsec int(11) DEFAULT NULL COMMENT '持续时长(秒)(从发起呼叫到结束呼叫之间的时长', direct int(11) DEFAULT NULL COMMENT '呼叫方向(1-呼入 2-呼出3-内部4-呼转)', answered int(11) DEFAULT NULL COMMENT '是否接通 1-接通 2-未接通(是否进行过通话', login_name varchar(32) DEFAULT NULL COMMENT '拨打人帐号', call_line varchar(6) DEFAULT NULL COMMENT '呼叫线路(金轮:JL, 智呼网页:ZHW, 智呼客户端:ZHC, 电信PC:DXPC,电信APP:DXAPP,工作机:GZJ)', phone_type varchar(20) DEFAULT NULL COMMENT '呼入设备型号', create_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新时间', PRIMARY KEY (id) USING BTREE, UNIQUE KEY uniqueid (uniqueid) USING BTREE, KEY idx_calltime (calltime) USING BTREE, KEY idx_src (src) USING BTREE ) ENGINE=MyISAM AUTO_INCREMENT=9273720 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC com.alibaba.fastsql.sql.parser.ParserException: syntax error, expect (, actual IDENTIFIER pos 1755, line 27, column 17, token IDENTIFIER uniqueid at com.alibaba.fastsql.sql.parser.SQLExprParser.accept(SQLExprParser.java:3053) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.parser.SQLExprParser.parseIndexRest(SQLExprParser.java:4108) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlExprParser.parseUnique(MySqlExprParser.java:875) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlCreateTableParser.parseConstraint(MySqlCreateTableParser.java:1373) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlCreateTableParser.parseCreateTable(MySqlCreateTableParser.java:287) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.dialect.mysql.parser.MySqlStatementParser.parseCreate(MySqlStatementParser.java:265) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:224) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.SQLUtils.parseStatements(SQLUtils.java:525) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.fastsql.sql.repository.SchemaRepository.console(SchemaRepository.java:439) ~[fastsql-2.0.0_preview_644.jar:2.0.0_preview_644] at com.alibaba.otter.canal.parse.inbound.mysql.tsdb.MemoryTableMeta.apply(MemoryTableMeta.java:78) ~[canal.parse-1.1.2.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache.parseTableMeta(TableMetaCache.java:104) [canal.parse-1.1.2.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache.getTableMetaByDB(TableMetaCache.java:90) [canal.parse-1.1.2.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache.access$000(TableMetaCache.java:32) [canal.parse-1.1.2.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache$1.load(TableMetaCache.java:58) [canal.parse-1.1.2.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache$1.load(TableMetaCache.java:53) [canal.parse-1.1.2.jar:na] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) [guava-18.0.jar:na] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) [guava-18.0.jar:na] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282) [guava-18.0.jar:na] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197) [guava-18.0.jar:na] at com.google.common.cache.LocalCache.get(LocalCache.java:3937) [guava-18.0.jar:na] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941) [guava-18.0.jar:na] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824) [guava-18.0.jar:na] at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830) [guava-18.0.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache.getTableMeta(TableMetaCache.java:188) [canal.parse-1.1.2.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert.getTableMeta(LogEventConvert.java:915) [canal.parse-1.1.2.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert.parseRowsEventForTableMeta(LogEventConvert.java:475) [canal.parse-1.1.2.jar:na]
原提问者GitHub用户tanhao-github
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。