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

insert two rows successfully with same primary key #16669

Closed
siddontang opened this issue Apr 21, 2020 · 0 comments
Closed

insert two rows successfully with same primary key #16669

siddontang opened this issue Apr 21, 2020 · 0 comments
Assignees
Labels
priority/P1 The issue has P1 priority. severity/critical type/bug The issue is confirmed as a bug.

Comments

@siddontang
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. What did you do?

mysql> use test;
Database changed
mysql> create table t (name varchar(256) primary key, v int);
Query OK, 0 rows affected (0.07 sec)

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

mysql> insert into t values ("a", 1), ("b", 3), ("a", 2) on duplicate key update v = v + 1;
Query OK, 4 rows affected (0.01 sec)
Records: 3  Duplicates: 1  Warnings: 0

mysql> select * from t;
+------+------+
| name | v    |
+------+------+
| a    |    2 |
| b    |    3 |
+------+------+
2 rows in set (0.00 sec)

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

mysql> select * from t;
+------+------+
| name | v    |
+------+------+
| a    |    2 |
| b    |    3 |
+------+------+
2 rows in set (0.01 sec)

mysql> insert into t values ("a", 1), ("b", 3), ("a", 2) on duplicate key update v = v + 1;
Query OK, 5 rows affected (0.00 sec)
Records: 3  Duplicates: 2  Warnings: 0

mysql> select * from t;
+------+------+
| name | v    |
+------+------+
| a    |    2 |
| b    |    4 |
| a    |    2 |
+------+------+
3 rows in set (0.00 sec)

2. What did you expect to see?

Only one row with a

3. What did you see instead?

Two rows

4. What version of TiDB are you using? (tidb-server -V or run select tidb_version(); on TiDB)

3.0.10

@siddontang siddontang added type/bug The issue is confirmed as a bug. priority/P1 The issue has P1 priority. labels Apr 21, 2020
@siddontang siddontang changed the title insert two rows with same primary key insert two rows successfully with same primary key, break transaction consistency Apr 21, 2020
@siddontang siddontang changed the title insert two rows successfully with same primary key, break transaction consistency insert two rows successfully with same primary key Apr 21, 2020
coocood pushed a commit that referenced this issue Apr 22, 2020
Fix issue #16669

When check the untouched index, we should also check the memory-buffer in the session too.
sre-bot pushed a commit to sre-bot/tidb that referenced this issue Apr 22, 2020
Fix issue pingcap#16669

When check the untouched index, we should also check the memory-buffer in the session too.
crazycs520 added a commit to crazycs520/tidb that referenced this issue Apr 22, 2020
Fix issue pingcap#16669

When check the untouched index, we should also check the memory-buffer in the session too.
crazycs520 added a commit to crazycs520/tidb that referenced this issue Apr 22, 2020
Fix issue pingcap#16669

When check the untouched index, we should also check the memory-buffer in the session too.
coocood pushed a commit that referenced this issue Apr 22, 2020
)

Fix issue #16669

When check the untouched index, we should also check the memory-buffer in the session too.
bb7133 pushed a commit that referenced this issue Apr 22, 2020
)

Fix issue #16669

When check the untouched index, we should also check the memory-buffer in the session too.
crazycs520 added a commit to crazycs520/tidb that referenced this issue Apr 23, 2020
Fix issue pingcap#16669

When check the untouched index, we should also check the memory-buffer in the session too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/P1 The issue has P1 priority. severity/critical type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants