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 produces different results for SELECT statement when using transaction which uses update stmt #30397

Open
JZuming opened this issue Dec 3, 2021 · 4 comments
Labels
severity/moderate sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.

Comments

@JZuming
Copy link

JZuming commented Dec 3, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Setup the environment:

tidb/bin/tidb-server &
mysql -h "127.0.0.1" -u root -P 4000 -D testdb < mysql_bk.sql

mysql_bk.sql:
mysql_bk.sql.txt

Testcase 1

mysql -h "127.0.0.1" -u root -P 4000 -D testdb
mysql> update t_berydd set c_cdqetd = t_berydd.c_ioru4c;
mysql> select count(c_mp6ko) from t_berydd;

Testcase 2

mysql -h "127.0.0.1" -u root -P 4000 -D testdb
mysql> start transaction;
mysql> update t_berydd set c_cdqetd = t_berydd.c_ioru4c;
mysql> select count(c_mp6ko) from t_berydd;
mysql> commit;

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

The outputs of SELECT statements in Testcase 1 and Testcase 2 are same.

3. What did you see instead (Required)

Output of SELECT statement in Testcase 1

+----------------+
| count(c_mp6ko) |
+----------------+
|             39 |
+----------------+

Output of SELECT statement in Testcase 2

+----------------+
| count(c_mp6ko) |
+----------------+
|             36 |
+----------------+

Their results are different.

4. What is your TiDB version? (Required)

Release Version: v5.4.0-alpha-311-g28446605c
Edition: Community
Git Commit Hash: 28446605c2e019e84e934602f4bd136294a61ff3
Git Branch: master
UTC Build Time: 2021-12-03 08:12:32
GoVersion: go1.16
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@JZuming JZuming added the type/bug The issue is confirmed as a bug. label Dec 3, 2021
@JZuming
Copy link
Author

JZuming commented Dec 3, 2021

Although issue#29947 has been fixed, these testcases still triggered the problem.

@JZuming JZuming changed the title TiDB produces different results for SELECT statement when using transaction TiDB produces different results for SELECT statement when using transaction which uses update stmt Dec 3, 2021
@zyguan
Copy link
Contributor

zyguan commented Dec 3, 2021

Thanks, @JZuming ! Like #30361, this bug is also related to unistore.

@zyguan
Copy link
Contributor

zyguan commented Dec 3, 2021

The count column processor of unistore is implemented incorrectly here, it always count the first column (c_ymgvrd in your case), that's why you got 39.
@JZuming can you test tidb with tikv? Unistore is only for test purpose.

@JZuming
Copy link
Author

JZuming commented Dec 3, 2021

@zyguan OK. I have set up the environment for testing tidb with tikv (using "tiup playground"). Hope new bugs can be detected.

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

No branches or pull requests

2 participants