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

[Bug]:Duplicate entry error in optimistic mode #21049

Open
1 task done
ouyuanning opened this issue Jan 2, 2025 · 3 comments
Open
1 task done

[Bug]:Duplicate entry error in optimistic mode #21049

ouyuanning opened this issue Jan 2, 2025 · 3 comments
Assignees
Labels
kind/bug Something isn't working severity/s0 Extreme impact: Cause the application to break down and seriously affect the use
Milestone

Comments

@ouyuanning
Copy link
Contributor

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main, 2.0-dev

Commit ID

main, 2.0-dev

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

mysql> create table t1(a int, b int, c int, primary key(a,b));
Query OK, 0 rows affected (0.02 sec)

mysql> insert into t1 select result,result,result from generate_series(200000) g;
Query OK, 200000 rows affected (0.33 sec)

mysql> update t1 set c =10 where a < 6000;
ERROR 1062 (HY000): Duplicate entry '3a15013a1501' for key '__mo_cpkey_col'

Expected Behavior

No response

Steps to Reproduce

1、use optimistic to start MO

//cn.toml
[cn.txn]
mode ="optimistic"

//tn.toml
[tn.txn]
mode ="optimistic"
  1. run sql :
select mo_ctl('cn', 'task', 'disable');
drop database if exists db1;
create database db1;
use db1;

create table t1(a int, b int, c int, primary key(a,b));
insert into t1 select result,result,result from generate_series(200000) g;
update t1 set c =10 where a < 6000; // error here


### Additional information

_No response_
@ouyuanning ouyuanning added kind/bug Something isn't working needs-triage labels Jan 2, 2025
@ouyuanning ouyuanning added this to the 2.0.2 milestone Jan 2, 2025
@ouyuanning ouyuanning added the severity/s0 Extreme impact: Cause the application to break down and seriously affect the use label Jan 2, 2025
@triump2020
Copy link
Contributor

TN  dosen't receive deletes when  run upate statement : `update t1 set c =10 where a < 6000`

@triump2020
Copy link
Contributor

triump2020 commented Jan 3, 2025

进一步分析, 当运行update 语句时,是因为 txn commit 时,workspace 中的 delete 与insert entry 顺序颠倒,而导致了tn 先处理insert entry 的去重就会报dup.

workspace 中的 delete ,insert entry 顺序颠倒是因为 dumpbatch 函数导致的.

@triump2020
Copy link
Contributor

wait for pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working severity/s0 Extreme impact: Cause the application to break down and seriously affect the use
Projects
None yet
Development

No branches or pull requests

3 participants