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

Filter condition is missing caused wrong result in cached table scanning #32422

Closed
tiancaiamao opened this issue Feb 17, 2022 · 2 comments · Fixed by #32590
Closed

Filter condition is missing caused wrong result in cached table scanning #32422

tiancaiamao opened this issue Feb 17, 2022 · 2 comments · Fixed by #32590
Assignees
Labels
feature/developing the related feature is in development severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@tiancaiamao
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> create table t (id int, c int);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into t values (3,3), (4,4), (5,5);
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> alter table t cache;
Query OK, 1 row affected (0.01 sec)

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

mysql>  select id+1, c from t where c = 4;
+------+------+
| id+1 | c    |
+------+------+
|    5 |    4 |
+------+------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

// Before the data is cached, the result is correct....
mysql>  select id+1, c from t where c = 4;
+------+------+
| id+1 | c    |
+------+------+
|    5 |    4 |
+------+------+
1 row in set (0.00 sec)

// Execute it several times, after the data is cached, the result become wrong...
// The filter condition c = 4 doesn't take effect.
mysql>  select id+1, c from t where c = 4;
+------+------+
| id+1 | c    |
+------+------+
|    4 |    3 |
|    5 |    4 |
|    6 |    5 |
+------+------+
3 rows in set (0.00 sec)

4. What is your TiDB version? (Required)

master db3e69e

The bug is introduced by #32139

@tiancaiamao tiancaiamao added type/bug The issue is confirmed as a bug. sig/sql-infra SIG: SQL Infra severity/major feature/developing the related feature is in development labels Feb 17, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. labels Feb 17, 2022
@tiancaiamao
Copy link
Contributor Author

Ref #25293

@tiancaiamao tiancaiamao removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. labels Feb 24, 2022
@tiancaiamao
Copy link
Contributor Author

A non-GA feature and this bug is introduced during developing, no release branchs are affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/developing the related feature is in development severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants