matrixorigin / matrixone

Hyperconverged cloud-edge native database
https://docs.matrixorigin.cn/en
Apache License 2.0
1.79k stars 277 forks source link

[Bug]: delete primary key values which not exists in explicit transactions failed #20216

Open heni02 opened 1 day ago

heni02 commented 1 day ago

Is there an existing issue for the same bug?

Branch Name

main

Commit ID

44f4d5b47ba00287973ecb8b06d12066d9519593

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

delete在显性事务中删除不存在的主键值,执行成功,但实际没有成功,导致再insert报dup的错误

企业微信截图_810af2ae-215f-47e4-969d-165d896bba44 企业微信截图_d7d06ac3-cb60-46cb-a3ac-31fb8d4c848b

试了下delete主键存在的值是没有问题的

企业微信截图_ba8b3a04-3e48-4bde-8bca-50c30ab5adf8 企业微信截图_d32b54e9-16f8-4b9a-951b-8e5e9ef284a4

2.0-dev也存在这个问题

Expected Behavior

No response

Steps to Reproduce

session1:
mysql> create table test1(a int primary key,b int);
Query OK, 0 rows affected (0.04 sec)

mysql> begin;
Query OK, 0 rows affected (0.00 sec)

mysql> delete from test1 where a=1;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into test1 values(1,10);
Query OK, 1 row affected (0.01 sec)

mysql> commit;
Query OK, 0 rows affected (0.02 sec)

session2:
mysql> begin;
Query OK, 0 rows affected (0.00 sec)

mysql> delete from test1 where a=1;
Query OK, 0 rows affected (6.61 sec)

mysql> insert into test1 values(1,10);
ERROR 1062 (HY000): Duplicate entry '1' for key 'a'

执行顺序: session1 commit之前,执行session2 delete ,然后session1 commit,之后session2 insert

Additional information

No response