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

TiDB doesn't lock non-existent unique-key when select for update from TiFlash #17851

Closed
lidezhu opened this issue Jun 8, 2020 · 2 comments · Fixed by #18458
Closed

TiDB doesn't lock non-existent unique-key when select for update from TiFlash #17851

lidezhu opened this issue Jun 8, 2020 · 2 comments · Fixed by #18458
Assignees
Labels
severity/critical sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.

Comments

@lidezhu
Copy link
Contributor

lidezhu commented Jun 8, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table:
create table if not exists txn0 (id int not null primary key, val text);

create tiflash replica and wait for the replica become available:
alter table txn0 set tiflash replica 1;

in the first terminal, type the following sql:
set @@session.tidb_isolation_read_engines = "tiflash";
begin pessimistic;
select val from txn0 where id = 25 for update;

in the second terminal, type the following sql:
insert into txn0 (id, val) values (25, '5');

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

The insert statement will get stuck.

3. What did you see instead (Required)

The insert statement succeed.

4. Affected version (Required)

v4.0.0,v3.1.0

5. Root Cause Analysis

@lidezhu lidezhu added the type/bug The issue is confirmed as a bug. label Jun 8, 2020
@djshow832 djshow832 added the sig/transaction SIG:Transaction label Jun 8, 2020
@ilovesoup
Copy link
Contributor

ilovesoup commented Jun 17, 2020

For 4.0 GA we added warning in TiFlash doc for not to use it in select for update since this scenarios is not thoroughly tested and other bug exists. This case seems rare, at least non of current users use like this according to my knowledge. If this cannot be fixed by 4.0.2, we will confirm docs include sufficient warning message for it.

@zanmato1984
Copy link
Contributor

Decided to go with "forbid tiflash in write transaction".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants