tiflow
tiflow copied to clipboard
Is it reasonable to discard this DDL "ALTER TABLE ...EXCHANGE PARTITION " ?
What did you do?
-
Now TiDB support EXCHANGE PARTITION, but TiCDC discard this DDL [2022/07/18 14:01:24.260 +08:00] [INFO] [schema_storage.go:252] ["discard DDL"] [jobID=270] [DDL="ALTER TABLE employees EXCHANGE PARTITION p3 WITH TABLE employees1"] [namespace=default] [changefeed=mysql-test1]
-
Reproduce steps:
- set tidb_enable_exchange_partition=1;
create a partition table: CREATE TABLE employees ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, fname VARCHAR(25) NOT NULL, lname VARCHAR(25) NOT NULL, store_id INT NOT NULL, department_id INT NOT NULL )
PARTITION BY RANGE(id) (
PARTITION p0 VALUES LESS THAN (5),
PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (15),
PARTITION p3 VALUES LESS THAN MAXVALUE
);
2. INSERT INTO employees VALUES ('1', 'Bob', 'Taylor', 3, 2);
select * from employees; -> As. partition rule,this row (id=1) write to p0 table
3. Create a new table that has the same table structure with the above paritition table employeeds , but has not any partition:
CREATE TABLE employees1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
fname VARCHAR(25) NOT NULL,
lname VARCHAR(25) NOT NULL,
store_id INT NOT NULL,
department_id INT NOT NULL,
PRIMARY KEY (id
)
);
-
ALTER TABLE employees EXCHANGE PARTITION p0 WITH TABLE employees1;
-
check if employees has not any row: select * from employees; check the row has transfered to employees1: select * from employees1;
What did you expect to see?
No response
What did you see instead?
If downstream is TiDB, discard this DDL will make query result different between upstream and downstream.
Versions of the cluster
Upstream TiDB cluster version (execute SELECT tidb_version();
in a MySQL client):
(paste TiDB cluster version here)
Upstream TiKV version (execute tikv-server --version
):
(paste TiKV version here)
TiCDC version (execute cdc version
):
(paste TiCDC version here)
Release Version: v6.2.0-alpha
Git Commit Hash: abc120caaf6bae9c64e9ed345618ecf303950409
Git Branch: heads/refs/tags/v6.2.0-alpha
UTC Build Time: 2022-07-17 14:25:40
Go Version: go version go1.18.2 linux/amd64
Failpoint Build: false
Seems that this DDL can be expessed by 'DML' between different tables. https://dev.mysql.com/doc/refman/5.7/en/partitioning-management-exchange.html
We can test this DDL by the example on the official website.
It's a bug. Need investigate why DML don't dealed by ticdc.
/assign @asddongmen