tiflow
tiflow copied to clipboard
TiCDC meet error: Duplicate entry xxx for key xxx
What did you do?
If the upstream cluster runs a transaction with multiple updates to the pk/uk like the following:
begin;
update t set pk=4 where pk=3;
update t set pk=3 where pk=2;
update t set pk=2 where pk =1;
commit;
This transaction may be split into two transactions inside ticdc: txn1
update t set pk=4 where pk=3;
update t set pk=3 where pk=2;
txn2
update t set pk=2 where pk =1;
And these two transactions have no order between them, so they may be executed in any order.
If txn2 executes first, it will meet error like Duplicate entry xxx for key xxx;
What did you expect to see?
The transaction can be successfully synced to downstream without error
What did you see instead?
ticdc report error: Duplicate entry xxx for key xxx
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)
/severity major