Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch updates can cause data loss when downstream is MySQL. #8453

Closed
asddongmen opened this issue Mar 7, 2023 · 0 comments
Closed

Batch updates can cause data loss when downstream is MySQL. #8453

asddongmen opened this issue Mar 7, 2023 · 0 comments
Labels
area/ticdc Issues or PRs related to TiCDC. type/bug The issue is confirmed as a bug.

Comments

@asddongmen
Copy link
Contributor

What did you do?

After enabling batch DML feature, when converting update statements, TiCDC will transform the statements into the following format:

from:

CREATE TABLE t0 ( id INT not null, name varchar(128) CHARACTER SET gbk not null, country char(32) CHARACTER SET gbk, city varchar(64), description  text CHARACTER SET gbk, image tinyblob, UNIQUE
KEY (id, name) ) ENGINE = Innodb;

UPDATE t0
SET name = '开发'
WHERE name = '测试';

covert to:

"UPDATE `test`.`t0` SET `id`=CASE WHEN ROW(`id`,`name`)=ROW(?,?) THEN ? END, `name`=CASE WHEN ROW(`id`,`name`)=ROW(?,?) THEN ? END, `country`=CASE WHEN ROW(`id`,`name`)=ROW(?,?) THEN ? END, `city`=CASE WHEN ROW(`id`,`name`)=ROW(?,?) THEN ? END, `description`=CASE WHEN ROW(`id`,`name`)=ROW(?,?) THEN ? END, `image`=CASE WHEN ROW(`id`,`name`)=ROW(?,?) THEN ? END WHERE ROW(`id`,`name`) IN (ROW(?,?))\"]"] [values="[[1,\"测试\",1,1,\"测试\",\"开发\",1,\"测试\",\"中国\",1,\"测试\",\"上海\",1,\"测试\",\"你好,世界\",1,\"测试\",\"xOO6w8rAvec=\",1,\"测试\"]]"

The behavior of this statement differs between TiDB and MySQL. However, all downstream integration tests of TiCDC currently use TiDB, so relevant issues were not previously detected.

What did you expect to see?

No response

What did you see instead?

.

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)
@asddongmen asddongmen added type/bug The issue is confirmed as a bug. area/ticdc Issues or PRs related to TiCDC. labels Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ticdc Issues or PRs related to TiCDC. type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

1 participant