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

Stale read failed for read-committed isolation when autocommit=0 #30872

Closed
lcwangchao opened this issue Dec 20, 2021 · 3 comments · Fixed by #33653
Closed

Stale read failed for read-committed isolation when autocommit=0 #30872

lcwangchao opened this issue Dec 20, 2021 · 3 comments · Fixed by #33653
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.0 severity/major sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.

Comments

@lcwangchao
Copy link
Collaborator

lcwangchao commented Dec 20, 2021

Bug Report

Stale read failed for read-committed isolation

1. Minimal reproduce step (Required)

drop table if exists t1;
create table t1(id int primary key);
set tx_isolation = 'READ-COMMITTED';
set autocommit=0;
select * from t1 as of timestamp now() where id=1;

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

mysql> select * from t1 as of timestamp now() where id=1;
Empty set (0.00 sec)

3. What did you see instead (Required)

mysql> select * from t1 as of timestamp now() where id=1;
ERROR 8024 (HY000): invalid transaction

4. What is your TiDB version? (Required)

master

@lcwangchao lcwangchao added type/bug The issue is confirmed as a bug. sig/transaction SIG:Transaction severity/major labels Dec 20, 2021
@zyguan
Copy link
Contributor

zyguan commented Dec 21, 2021

Hi, @lcwangchao , which commit do you use? I only got some E1146: Table 'test.t1' doesn't exist occasionally with latest master (55a38cb).

@lcwangchao lcwangchao changed the title Stale read failed for read-committed isolation Stale read failed for read-committed isolation when autocommit=0 Dec 22, 2021
@lcwangchao
Copy link
Collaborator Author

lcwangchao commented Dec 22, 2021

@zyguan sorry, the previous description is not right and I just modified it. This error occurs when read-committed and autocommit=0 .

@zyguan
Copy link
Contributor

zyguan commented Dec 24, 2021

It seems ts future won't be prepared since #29393 , tidb tried to active transaction for the point select statement (as the following stack shown), and then invalid transaction got returned here. @Yisaer could you take a look?

github.com/pingcap/tidb/executor.(*executorBuilder).getSnapshotTS
        /home/zyguan/src/pingcap/tidb/executor/builder.go:1502
github.com/pingcap/tidb/executor.(*executorBuilder).buildPointGet
        /home/zyguan/src/pingcap/tidb/executor/point_get.go:51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.0 severity/major 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.

4 participants