pingcap/tidb

Query in transaction may return rows with same unique index column value

Open

#24,195 创建于 2021年4月21日

在 GitHub 查看
 (14 评论) (0 反应) (1 负责人)Go (6,186 fork)batch import
affects-5.0affects-5.1affects-5.2affects-5.3affects-5.4affects-6.0affects-6.1affects-6.2affects-6.3affects-6.4affects-6.5affects-6.6affects-7.0affects-7.1help wantedseverity/moderatesig/transactiontype/bug

仓库指标

Star
 (40,090 star)
PR 合并指标
 (平均合并 14天 4小时) (30 天内合并 346 个 PR)

描述

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t;
create table t (a int, b int, primary key (a, b) /*T![clustered_index] nonclustered */);
insert into t values (1, 10);
begin optimistic;
insert into t values (1, 10);
select * from t;
commit;

2. What did you expect to see? (Required)

Only one row is returned by the select statement.

3. What did you see instead (Required)

mysql> /* t */ select * from t; -- (1, 10), (1, 10)
+---+----+
| a | b  |
+---+----+
| 1 | 10 |
| 1 | 10 |
+---+----+
2 rows in set (0.00 sec)

mysql> /* t */ commit;
ERROR 1062 (23000): Duplicate entry '1-10' for key 'PRIMARY'

4. What is your TiDB version? (Required)

Release Version: v5.0.0-43-g41871e0c8 Edition: Community Git Commit Hash: 41871e0c8e5e4b0601dd94d09342bc0317cbb8cb Git Branch: release-5.0 UTC Build Time: 2021-04-20 09:24:52 GoVersion: go1.13 Race Enabled: false TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306 Check Table Before Drop: false

贡献者指南