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

sink to mysql (ticdc) conflict detector has potential dead lock when a single transaction generate multiple same hashes #10334

Closed
zhangjinpeng87 opened this issue Dec 21, 2023 · 0 comments · Fixed by #10335
Assignees
Labels
affects-6.5 affects-7.1 affects-7.5 area/ticdc Issues or PRs related to TiCDC. severity/major This is a major bug. type/bug This is a bug.

Comments

@zhangjinpeng87
Copy link
Contributor

The conflict detector is used to construct dependency graph (DAG). Each transaction has a related node in the DAG. Each transaction may contains multiple rows, each row may has multiple keys need to check conflict in the DAG because related table may have unique indices:

table (a, b, c, d, primary(a, b), unique index(b, c));

When TiCDC check the conflict between a new transaction and existing transactions, TiCDC need to construct primary key and all unique key hashes for each rows. Let's use the above table as an example, each row will generate 2 hashes, one for primary key(a, b), one for unique index(b, c). This transaction use these hashes to join into the existing dependency graph, and calculating potential conflicts with existing transactions.

https://github.com/pingcap/tiflow/blob/master/pkg/causality/worker.go#L28 should generate deduplicated hashes for a transaction, but https://github.com/pingcap/tiflow/blob/master/cdc/sink/dmlsink/txn/event.go#L45-L48 doesn't dedup hashes for the transaction. This may cause self cyclic dependency in the DAG which cause dead lock issue (the conflict detector blocked on this transaction, and changefeed checkpoint ts stack).

@zhangjinpeng87 zhangjinpeng87 self-assigned this Dec 21, 2023
@zhangjinpeng87 zhangjinpeng87 added the type/bug This is a bug. label Dec 21, 2023
@github-actions github-actions bot added this to Need Triage in Question and Bug Reports Dec 21, 2023
Question and Bug Reports automation moved this from Need Triage to Done Dec 27, 2023
ti-chi-bot bot pushed a commit that referenced this issue Dec 27, 2023
ti-chi-bot bot pushed a commit that referenced this issue Dec 28, 2023
@jebter jebter added the area/ticdc Issues or PRs related to TiCDC. label Feb 1, 2024
ti-chi-bot bot pushed a commit that referenced this issue Feb 2, 2024
ti-chi-bot bot pushed a commit that referenced this issue Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 affects-7.1 affects-7.5 area/ticdc Issues or PRs related to TiCDC. severity/major This is a major bug. type/bug This is a bug.
3 participants