syncer上游执行create Table就挂
启动syncer工具同步数据,大部分情况一切正常 但是在上游mysql (mysql版本5.7)终端执行
CREATE TABLE user2 (
id int not null,
name varchar(45) null,
primary key(id));
上游创建表执行成功 但是syncer马上挂掉,下游也不会创建表 报错信息
2018/02/24 15:04:18 syncer.go:614: [info] [query]CREATE TABLE user2 ( id int not null, name varchar(45) null, primary key(id)) [pos](mysql-bin.000001, 123) [next pos](mysql-bin.000001, 368) [gtid]
2018/02/24 15:04:18 syncer.go:637: [info] [ddl][schema]db1 [start]USE `db1`; CREATE TABLE user2 ( id int not null, name varchar(45) null, primary key(id));
2018/02/24 15:04:18 db.go:124: [debug] [exec][sql]USE `db1`; CREATE TABLE user2 ( id int not null, name varchar(45) null, primary key(id));[args][]
2018/02/24 15:04:18 db.go:128: [warning] [exec][sql]USE `db1`; CREATE TABLE user2 ( id int not null, name varchar(45) null, primary key(id));[args][][error]Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE user2 ( id int not null, name varchar(45) null, primary key(id))' at line 1
2018/02/24 15:04:18 db.go:100: [error] [exec][sql][USE `db1`; CREATE TABLE user2 ( id int not null, name varchar(45) null, primary key(id));][args][[]][error]Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE user2 ( id int not null, name varchar(45) null, primary key(id))' at line 1
2018/02/24 15:04:18 syncer.go:352: [fatal] Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE user2 ( id int not null, name varchar(45) null, primary key(id))' at line 1
/home/jenkins/workspace/build_tidb_enterprise_tools_master/go/src/github.com/pingcap/tidb-enterprise-tools/syncer/db.go:134:
/home/jenkins/workspace/build_tidb_enterprise_tools_master/go/src/github.com/pingcap/tidb-enterprise-tools/syncer/db.go:101:
帮忙看下是什么原因?
1064
@dbaspace 说我语法错误,但是上游我用MysqlWorkbench或者终端执行创建表语句都是成功的,就是syncer挂了
1 queries executed, 0 success, 1 errors, 0 warnings
查询:CREATE TABLE user2 ( id int not null, name varchar(45) null, primary key(id)))
错误代码: 1105 line 4 column 22 near "" (total length 92)
执行耗时 : 0 sec 传送时间 : 0 sec 总耗时 : 0.008 sec 这个是你的,,,
我的建表就没问题: CREATE TABLE aa(id INT PRIMARY KEY,NAME VARCHAR(45))
这个是在TIDB 里执行的,,@ivancxj
这个东西是挺不错的,要上线 还是要慎重,因为还是有一定坑的,,没法百度,你懂的
CREATE TABLE user2 ( id int not null, name varchar(45) null, primary key(id))) 这个语句最后多了一个右括号?
@shenli 我手动写错了 实际上就是2个右括号, 在上游mysql执行成功了
@dbaspace 我不是在tidb执行, 我是在mysql执行
测试了该用例,没有复现,该 ddl 成功同步下游,请附加 mysql 客户端、syncer、tidb 版本信息。
2018/02/27 17:52:32 syncer.go:352: [fatal] Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'create table if not exists master_order_01 ( forderid varchar(30) default '' c' at line 1 /home/XX/workspace/build_tidb_enterprise_tools_master/go/src/github.com/pingcap/tidb-enterprise-tools/syncer/db.go:134: /home/XX/workspace/build_tidb_enterprise_tools_master/go/src/github.com/pingcap/tidb-enterprise-tools/syncer/db.go:101:
也发现类似问题,上游创建表执行成功。直接在mysql执行是也成功的 mysql版本5.7
skip-ddls = ["create\s+table"] 这样可以跳过DDL语句吗?好像没起作用
CREATE TABLE ..... 没有问题 如果是CREATE TABLE IF NOT EXISTS ....就会报上会的错误
我意思是 用的DDL 在TIDB 执行报错: 查询:CREATE TABLE user2 ( id int not null, name varchar(45) null, primary key(id)))
错误代码: 1105 line 4 column 22 near "" (total length 92) 这个,,,改成我那个就没问题的,,,说明还是TIDB问题
@dbaspace 你刚才发的那个语句 最后多了一个括号
@dbaspace 这是我在 mysql 5.7 上的测试结果:
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 92
Server version: 5.7.21-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> CREATE TABLE user2 ( id int not null, name varchar(45) null, primary key(id)))
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
mysql>
这里的一个问题是无论是否语法错误,sync都不应该挂掉把?
@laihuchun 如果syncer 遇到这种情况而不退出,那意味着这条 sql 要被忽略掉,就丢数据了。
@holys 丢部分数据重要还是保持大部分数据同步,要视业务类型来决定吧?是否该提供一个可选项可供配置呢?
@laihuchun 如果是丢了ddl 的话,会影响整个表的数据同步。我们暂时不考虑提供该功能。谢谢关注。