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

"Select For Update" in decorrelated subquery return WriteConflictError in pessimistic mode #22345

Open
lysu opened this issue Jan 11, 2021 · 2 comments
Labels
severity/minor sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.

Comments

@lysu
Copy link
Contributor

lysu commented Jan 11, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(id int primary key, v int);
insert into t values(1, 10), (2, 20);

-- txn1: begin pessimistic;
-- txn1: select * from t;
-- txn2: update t set v = v * 10;
-- txn1:  select (select v from t where id = 2 for update) from dual;

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

last stmt return newest value --- 200, just as normal select v from t where id = 2 for update

3. What did you see instead (Required)

ERROR 9007 (HY000): Write conflict, txnStartTS=422143966855823360, conflictStartTS=422143970145468416, conflictCommitTS=422143970145730560, key={tableID=49, handle=2} primary=[]byte(nil) [try again later]

4. What is your TiDB version? (Required)

master
@lysu lysu added the type/bug The issue is confirmed as a bug. label Jan 11, 2021
@lysu
Copy link
Contributor Author

lysu commented Jan 11, 2021

EvalSubqueryFirstRow

err = Next(ctx, exec, chk)
maybe also need handlePessimisticLockError like handlePessimisticSelectForUpdate method

@cfzjywxk
Copy link
Contributor

As the usage is not that common, I change the severity to minor and the pr could be merged if @lysu has time.

@zimulala zimulala removed this from the v5.0.0 ga milestone Mar 23, 2021
@lysu lysu removed their assignment Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor 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