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

Duplicate entry 'xxxx' for key #8552

Closed
sdojjy opened this issue Mar 16, 2023 · 0 comments · Fixed by #8553
Closed

Duplicate entry 'xxxx' for key #8552

sdojjy opened this issue Mar 16, 2023 · 0 comments · Fixed by #8553
Labels
affects-6.1 affects-6.5 affects-6.6 area/ticdc Issues or PRs related to TiCDC. severity/major type/bug The issue is confirmed as a bug.

Comments

@sdojjy
Copy link
Member

sdojjy commented Mar 16, 2023

table schema

create table handle_records (
id varbinary(16) NOT NULL,
store_id varbinary(16) default null,
source_type varchar(255) default null,
source_id varbinary(16) default null,
handle varchar(255) default null,
Primary key(id),
unique key unique_index_handle_records_on_handle(store_id, handle, source_type)
)engine=innoDB default charset=utf8mb4

existing data

MySQL root@127.0.0.1:test> select * from handle_records;
+----+------------------+-------------+-----------+--------+
| id | store_id         | source_type | source_id | handle |
+----+------------------+-------------+-----------+--------+
| e  | 0x5942c803664b00 | x           | <null>    | c      |
| f  | 0x5942c803664b00 | d           | <null>    | c      |
+----+------------------+-------------+-----------+--------+

The transaction on upstream

begin;
update handle_records set source_type = 'x' where id = 'e';
insert into handle_records(id, store_id, handle, source_type) values ('f', 0x5942C803664B00, 'c',  'd');
commit;

when batch dml is enable , cdc will execute transaction like

begin;
insert into handle_records(id, store_id, handle, source_type) values ('f', 0x5942C803664B00, 'c',  'd');
update handle_records set source_type = 'x' where id = 'e';
commit;
@sdojjy sdojjy added type/bug The issue is confirmed as a bug. area/ticdc Issues or PRs related to TiCDC. affects-6.1 affects-6.5 affects-6.6 labels Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.1 affects-6.5 affects-6.6 area/ticdc Issues or PRs related to TiCDC. severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants