dmv8.1.0版本同步list分区表的删除分区的ddl语句时报错,但下游能够正常执行

,

Bug 反馈
dmv8.1.0版本同步list分区表的删除分区的ddl语句时报错,但下游能够正常执行
【 TiDB 版本】
8.1.0
【 Bug 的影响】

【可能的问题复现步骤】
首先部署mysql到tidb的dm同步
下游设置 SET GLOBAL tidb_enable_list_partition = ON;
然后上游执行
CREATE TABLE employees11 (
id INT NOT NULL,
hired DATE NOT NULL DEFAULT ‘1970-01-01’,
store_id INT,
PRIMARY KEY (id,store_id)
)
PARTITION BY LIST (store_id) (
PARTITION pNorth VALUES IN (1, 2, 3, 4, 5),
PARTITION pEast VALUES IN (6, 7, 8, 9, 10),
PARTITION pWest VALUES IN (11, 12, 13, 14, 15),
PARTITION pCentral VALUES IN (16, 17, 18, 19, 20)
) ;

ALTER TABLE employees11 DROP PARTITION pEast;
【看到的非预期行为】
下游查看表结构
SHOW CREATE TABLE employees11;

CREATE TABLE employees11 (
id INT(11) NOT NULL,
hired DATE NOT NULL DEFAULT ‘1970-01-01’,
store_id INT(11) NOT NULL,
PRIMARY KEY (id,store_id) /*T![clustered_index] NONCLUSTERED */
) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
PARTITION BY LIST (store_id)
(PARTITION pNorth VALUES IN (1,2,3,4,5),
PARTITION pEast VALUES IN (6,7,8,9,10),
PARTITION pWest VALUES IN (11,12,13,14,15),
PARTITION pCentral VALUES IN (16,17,18,19,20))

dm查看task状态
“Message”: “startLocation: [position: (mysql-bin.000001, 56898730), gtid-set: 00000000-0000-0000-0000-000000000000:0], endLocation: [position: (mysql-bin.000001, 56898854), gtid-set: 00000000-0000-0000-0000-000000000000:0], origin SQL: [ALTER TABLE employees11 DROP PARTITION pEast]: cannot track DDL: ALTER TABLE testdm8.employees11 DROP PARTITION pEast
【期望看到的行为】
下游正常同步执行删除分区操作
SHOW CREATE TABLE employees11;

CREATE TABLE employees11 (
id INT(11) NOT NULL,
hired DATE NOT NULL DEFAULT ‘1970-01-01’,
store_id INT(11) NOT NULL,
PRIMARY KEY (id,store_id) /*T![clustered_index] NONCLUSTERED */
) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
PARTITION BY LIST (store_id)
(PARTITION pNorth VALUES IN (1,2,3,4,5),
PARTITION pWest VALUES IN (11,12,13,14,15),
PARTITION pCentral VALUES IN (16,17,18,19,20))
【相关组件及具体版本】
dm v8.1.0
【其他背景信息或者截图】

======================================================
ALTER TABLE employees11 DROP PARTITION pEast;
【看到的非预期行为】
上游查看表结构
SHOW CREATE TABLE employees11;

CREATE TABLE employees11 (
id INT(11) NOT NULL,
hired DATE NOT NULL DEFAULT ‘1970-01-01’,
store_id INT(11) NOT NULL,
PRIMARY KEY (id,store_id) /*T![clustered_index] NONCLUSTERED */
) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
PARTITION BY LIST (store_id)
(PARTITION pNorth VALUES IN (1,2,3,4,5),
PARTITION pEast VALUES IN (6,7,8,9,10),
PARTITION pWest VALUES IN (11,12,13,14,15),
PARTITION pCentral VALUES IN (16,17,18,19,20))

上游查看表结构,这个 pEast 都 drop 了为啥 show 出来还能看到pEast 这个分区?是贴错了吗?

就是我通过dm同步mysql到tidb,我在上游删除了这个表分区,但是下游还能看见,然后dm里面报错startLocation: [position: (mysql-bin.000001, 56898730), gtid-set: 00000000-0000-0000-0000-000000000000:0], endLocation: [position: (mysql-bin.000001, 56898854), gtid-set: 00000000-0000-0000-0000-000000000000:0], origin SQL: [ALTER TABLE employees11 DROP PARTITION pEast]: cannot track DDL: ALTER TABLE testdm8.employees11 DROP PARTITION pEast
然后下游show create table,发现分区没删掉,
但是如果单独在下游执行 ALTER TABLE employees11 DROP PARTITION pEast;
是可以执行的。
帖子可能写的有点问题,我编辑下

@tidb菜鸟一只 您好,麻烦提供一下 dm 这个同步这个 ddl 报错期间的 log ,以及 query-status 看到的这个错误message 的 RawCause,谢谢。

[2024/07/17 16:13:27.422 +08:00] [ERROR] [subtask.go:359] [“unit process error”] [subtask=testdm8] [unit=Sync] [“error information”="ErrCode:44006 ErrClass:"schema-tracker" ErrScope:"internal" ErrLevel:
"high" Message:"startLocation: [position: (mysql-bin.000001, 56898730), gtid-set: 00000000-0000-0000-0000-000000000000:0], endLocation: [position: (mysql-bin.000001, 56898854), gtid-set: 00000000-0000-0000
-0000-000000000000:0], origin SQL: [ALTER TABLE employees11 DROP PARTITION pEast]: cannot track DDL: ALTER TABLE testdm8.employees11 DROP PARTITION pEast" RawCause:"[ddl:1505]Partition management on
a not partitioned table is not possible" Workaround:"You can use handle-error to replace or skip this DDL." "]

您好,初步确认是 bug, Issues · pingcap/tiflow · GitHub issue 更新。
感谢反馈,抱歉给您的使用带来不便。

是不是因为先搭建了 DM,然后才修改的tidb_enable_list_partition导致的。直接stop-task + start-task看下还会不会复现?

dm是执行过stop-task + resume-task操作的

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。