0

I'am using tidb syncer to replicate data from mysql to tidb. But I don't exactly understand the meaning of the warning "will split alter table statement".

I've just issued the simple alter table query below. Why does it split the statement and How does it effect my schema or data of tidb.

ALTER TABLE `agg_url_base` ADD COLUMN `price` INT NULL AFTER `consumption`

There are tidb's syncer logs below.

2019/02/11 07:45:44 meta.go:135: [info] save position to file, binlog-name:mysql-bin.000153 binlog-pos:15852122 binlog-gtid:
2019/02/11 07:45:46 ddl.go:103: [warning] will split alter table statement: ALTER TABLE `agg_url_base` ADD COLUMN `price` INT NULL AFTER `consumption`
2019/02/11 07:45:46 ast.go:508: [info] spec &{node:{text:} Tp:2 Name: Constraint:<nil> Options:[] NewTable:<nil> NewColumns:[0xc0003616c0] OldColumnName:<nil> Position:0xc0005d10a0 LockType:0 Comment: FromKey: ToKey: PartDefinitions:[] Num:0}
2019/02/11 07:45:46 ddl.go:107: [warning] splitted alter table statement: [ALTER TABLE `agg_url_base` ADD COLUMN `price` int(11) NULL AFTER `consumption`]
2019/02/11 07:45:46 syncer.go:745: [info] [query]ALTER TABLE `agg_url_base` ADD COLUMN `price` INT NULL AFTER `consumption` [current pos](mysql-bin.000153, 15852977) [next pos](mysql-bin.000153, 15853214) [current gtid set] [next gtid set]<nil>
2019/02/11 07:45:46 syncer.go:784: [info] [ddl][schema]adn [start]USE `adn`; ALTER TABLE `agg_url_base` ADD COLUMN `price` int(11) NULL AFTER `consumption`;
2019/02/11 07:45:47 meta.go:135: [info] save position to file, binlog-name:mysql-bin.000153 binlog-pos:15853214 binlog-gtid:
2019/02/11 07:45:47 syncer.go:792: [info] [ddl][end]USE `adn`; ALTER TABLE `agg_url_base` ADD COLUMN `price` int(11) NULL AFTER `consumption`;

1 Answers1

0

Why does it split the statement

In TiDB, multi DDLs should be executed one by one. If you execute one query with muti DDLs (like modifying multi-columns in one query) in the upstream MySQL, it will be split to multi queries (one query with only one DDL) in Syncer and then executed in TiDB.

How does it effect my schema or data of tidb

The effect of the query will not be changed just like executing multi queries one by one if your original query combines multi DDLs. In fact, you may treat this warning just as an info.