Skip to content

consumer write incorrect DDL message #1902

@River2000i

Description

@River2000i

What did you do?

cdc_lightning_comp_kafka test

[2025/09/03 14:17:30.708 +08:00] [ERROR] [mysql_writer_ddl.go:92] ["Fail to ExecContext"] [err="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 'CLUSTERED,INDEX `k_10`(`k`)) ENGINE = InnoDB DEFAULT CHARACTER SET = UTF8MB4 DEF' at line 1"] [query="CREATE TABLE IF NOT EXISTS `sbtest`.`sbtest10` (`id` INT(11) NOT NULL AUTO_INCREMENT,`k` INT(11) NOT NULL DEFAULT _UTF8MB4'0',`c` CHAR(120) NOT NULL DEFAULT _UTF8MB4'',`pad` CHAR(60) NOT NULL DEFAULT _UTF8MB4'',PRIMARY KEY(`id`) CLUSTERED,INDEX `k_10`(`k`)) ENGINE = InnoDB DEFAULT CHARACTER SET = UTF8MB4 DEFAULT COLLATE = UTF8MB4_BIN AUTO_INCREMENT = 345247;"]
[2025/09/03 14:17:30.708 +08:00] [WARN] [mysql_writer_ddl.go:128] ["Execute DDL with error, retry later"] [ddl="CREATE TABLE IF NOT EXISTS `sbtest`.`sbtest10` (`id` INT(11) NOT NULL AUTO_INCREMENT,`k` INT(11) NOT NULL DEFAULT _UTF8MB4'0',`c` CHAR(120) NOT NULL DEFAULT _UTF8MB4'',`pad` CHAR(60) NOT NULL DEFAULT _UTF8MB4'',PRIMARY KEY(`id`) CLUSTERED,INDEX `k_10`(`k`)) ENGINE = InnoDB DEFAULT CHARACTER SET = UTF8MB4 DEFAULT COLLATE = UTF8MB4_BIN AUTO_INCREMENT = 345247;"] [error="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 'CLUSTERED,INDEX `k_10`(`k`)) ENGINE = InnoDB DEFAULT CHARACTER SET = UTF8MB4 DEF' at line 1"]
[2025/09/03 14:17:30.708 +08:00] [PANIC] [writer.go:432] ["write DDL event failed"] [error="[CDC:ErrMySQLTxnError]MySQL txn error: Execute DDL failed, Query info: CREATE TABLE IF NOT EXISTS `sbtest`.`sbtest10` (`id` INT(11) NOT NULL AUTO_INCREMENT,`k` INT(11) NOT NULL DEFAULT _UTF8MB4'0',`c` CHAR(120) NOT NULL DEFAULT _UTF8MB4'',`pad` CHAR(60) NOT NULL DEFAULT _UTF8MB4'',PRIMARY KEY(`id`) CLUSTERED,INDEX `k_10`(`k`)) ENGINE = InnoDB DEFAULT CHARACTER SET = UTF8MB4 DEFAULT COLLATE = UTF8MB4_BIN AUTO_INCREMENT = 345247;; : 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 'CLUSTERED,INDEX `k_10`(`k`)) ENGINE = InnoDB DEFAULT CHARACTER SET = UTF8MB4 DEF' at line 1"] [errorVerbose="[CDC:ErrMySQLTxnError]MySQL txn error: Execute DDL failed, Query info: CREATE TABLE IF NOT EXISTS `sbtest`.`sbtest10` (`id` INT(11) NOT NULL AUTO_INCREMENT,`k` INT(11) NOT NULL DEFAULT _UTF8MB4'0',`c` CHAR(120) NOT NULL DEFAULT _UTF8MB4'',`pad` CHAR(60) NOT NULL DEFAULT _UTF8MB4'',PRIMARY KEY(`id`) CLUSTERED,INDEX `k_10`(`k`)) ENGINE = InnoDB DEFAULT CHARACTER SET = UTF8MB4 DEFAULT COLLATE = UTF8MB4_BIN AUTO_INCREMENT = 345247;; : 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 'CLUSTERED,INDEX `k_10`(`k`)) ENGINE = InnoDB DEFAULT CHARACTER SET = UTF8MB4 DEF' at line 1\ngithub.com/pingcap/errors.AddStack\n\tgithub.com/pingcap/[email protected]/errors.go:178\ngithub.com/pingcap/errors.(*Error).GenWithStackByArgs\n\tgithub.com/pingcap/[email protected]/normalize.go:175\ngithub.com/pingcap/ticdc/pkg/errors.WrapError\n\tgithub.com/pingcap/ticdc/pkg/errors/helper.go:35\ngithub.com/pingcap/ticdc/pkg/sink/mysql.(*Writer).execDDLWithMaxRetries.func1\n\tgithub.com/pingcap/ticdc/pkg/sink/mysql/mysql_writer_ddl.go:131\ngithub.com/pingcap/ticdc/pkg/retry.run\n\tgithub.com/pingcap/ticdc/pkg/retry/retry_with_opt.go:57\ngithub.com/pingcap/ticdc/pkg/retry.Do\n\tgithub.com/pingcap/ticdc/pkg/retry/retry_with_opt.go:34\ngithub.com/pingcap/ticdc/pkg/sink/mysql.(*Writer).execDDLWithMaxRetries\n\tgithub.com/pingcap/ticdc/pkg/sink/mysql/mysql_writer_ddl.go:112\ngithub.com/pingcap/ticdc/pkg/sink/mysql.(*Writer).FlushDDLEvent\n\tgithub.com/pingcap/ticdc/pkg/sink/mysql/mysql_writer.go:118\ngithub.com/pingcap/ticdc/downstreamadapter/sink/mysql.(*Sink).WriteBlockEvent\n\tgithub.com/pingcap/ticdc/downstreamadapter/sink/mysql/sink.go:237\nmain.(*writer).flushDDLEvent\n\tgithub.com/pingcap/ticdc/cmd/kafka-consumer/writer.go:176\nmain.(*writer).Write\n\tgithub.com/pingcap/ticdc/cmd/kafka-consumer/writer.go:431\nmain.(*writer).WriteMessage\n\tgithub.com/pingcap/ticdc/cmd/kafka-consumer/writer.go:413\nmain.(*consumer).readMessage\n\tgithub.com/pingcap/ticdc/cmd/kafka-consumer/consumer.go:132\nmain.(*consumer).Run.func2\n\tgithub.com/pingcap/ticdc/cmd/kafka-consumer/consumer.go:156\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/[email protected]/errgroup/errgroup.go:79\nruntime.goexit\n\truntime/asm_amd64.s:1700"] [DDL="CREATE TABLE IF NOT EXISTS `sbtest`.`sbtest10` (`id` INT(11) NOT NULL AUTO_INCREMENT,`k` INT(11) NOT NULL DEFAULT _UTF8MB4'0',`c` CHAR(120) NOT NULL DEFAULT _UTF8MB4'',`pad` CHAR(60) NOT NULL DEFAULT _UTF8MB4'',PRIMARY KEY(`id`) CLUSTERED,INDEX `k_10`(`k`)) ENGINE = InnoDB DEFAULT CHARACTER SET = UTF8MB4 DEFAULT COLLATE = UTF8MB4_BIN AUTO_INCREMENT = 345247;"] [commitTs=460555614037213219] [stack="main.(*writer).Write\n\tgithub.com/pingcap/ticdc/cmd/kafka-consumer/writer.go:432\nmain.(*writer).WriteMessage\n\tgithub.com/pingcap/ticdc/cmd/kafka-consumer/writer.go:413\nmain.(*consumer).readMessage\n\tgithub.com/pingcap/ticdc/cmd/kafka-consumer/consumer.go:132\nmain.(*consumer).Run.func2\n\tgithub.com/pingcap/ticdc/cmd/kafka-consumer/consumer.go:156\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/[email protected]/errgroup/errgroup.go:79"]

What did you expect to see?

No response

What did you see instead?

https://github.com/pingcap/tiflow/blob/33ea0edd95ceac1ddd1ad3af0c358d8533367551/cdc/owner/ddl_sink.go#L432

translate to special comment

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributionThis PR is from a community contributor.type/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions