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

wrong result when point get new collation column for unknown reason #23898

Closed
time-and-fate opened this issue Apr 7, 2021 · 7 comments
Closed
Assignees
Labels
sig/sql-infra SIG: SQL Infra

Comments

@time-and-fate
Copy link
Member

time-and-fate commented Apr 7, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

start tidb with real tikv and with new collation turned on.

backup.zip

unzip the file and restore it using BR:

./br restore full --pd "PDIP:2379" -s "local:///path/to/this/backup"

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

get correct result

3. What did you see instead (Required)

got different results of the same row

root:4000[clustered_index_go_c]> select col_7, col_8 from tbl_1 where col_7 = 1124440639;
+------------+-------+
| col_7      | col_8 |
+------------+-------+
| 1124440639 | J    |
+------------+-------+
1 row in set (0.005 sec)

root:4000[clustered_index_go_c]> select col_7, col_8 from tbl_1  where col_7 > 1124440630 and col_7 < 1124440640;
+------------+-------+
| col_7      | col_8 |
+------------+-------+
| 1124440639 | B     |
+------------+-------+
1 row in set (0.004 sec)

root:4000[clustered_index_go_c]> explain select col_7, col_8 from tbl_1  where col_7 > 1124440630 and col_7 < 1124440640;
+------------------------+---------+-----------+---------------------------------+---------------------------------------------------------------+
| id                     | estRows | task      | access object                   | operator info                                                 |
+------------------------+---------+-----------+---------------------------------+---------------------------------------------------------------+
| IndexReader_6          | 250.00  | root      |                                 | index:IndexRangeScan_5                                        |
| └─IndexRangeScan_5     | 250.00  | cop[tikv] | table:tbl_1, index:idx_2(col_7) | range:(1124440630,1124440640), keep order:false, stats:pseudo |
+------------------------+---------+-----------+---------------------------------+---------------------------------------------------------------+
2 rows in set (0.002 sec)

root:4000[clustered_index_go_c]> explain select col_7, col_8 from tbl_1 where col_7 = 1124440639;
+-------------+---------+------+---------------------------------+---------------+
| id          | estRows | task | access object                   | operator info |
+-------------+---------+------+---------------------------------+---------------+
| Point_Get_1 | 1.00    | root | table:tbl_1, index:idx_2(col_7) |               |
+-------------+---------+------+---------------------------------+---------------+
1 row in set (0.001 sec)

4. What is your TiDB version? (Required)

root:4000[clustered_index_go_c]> select tidb_version();
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                                     |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v5.0.0-nightly
Edition: Community
Git Commit Hash: e2740f54b6b29d99f3396bed4e66779549becf75
Git Branch: heads/refs/tags/v5.0.0-nightly
UTC Build Time: 2021-04-02 16:25:23
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.021 sec)
@time-and-fate time-and-fate added the type/bug The issue is confirmed as a bug. label Apr 7, 2021
@time-and-fate
Copy link
Member Author

time-and-fate commented Apr 7, 2021

It's very strange that you can't reproduce this issue after

create table tt like tbl_1;
insert into tt select * from tbl_1;

You also can't reproduce this issue after dumping the table into .sql file and restore it.

@lysu
Copy link
Contributor

lysu commented Apr 7, 2021

It's very strange that you can't reproduce this issue after

create table tt like tbl_1;
insert into tt select * from tbl_1;

You also can't reproduce this issue after dumping the table into .sql file and restore it.

how about

set global tidb_row_format_version=1 or 2

and reconnect & retry

@time-and-fate
Copy link
Member Author

It's very strange that you can't reproduce this issue after

create table tt like tbl_1;
insert into tt select * from tbl_1;

You also can't reproduce this issue after dumping the table into .sql file and restore it.

how about

set global tidb_row_format_version=1 or 2

and reconnect & retry

Currently the tidb_row_format_version is 2. I set it to 1 and reconnect & retry, the issue still exists.

@time-and-fate
Copy link
Member Author

time-and-fate commented Apr 7, 2021

The original SQL which makes the test fail is different from the issue description.
The original output of the rand test: a.log
(clustered index and new collation are both enabled when testing)

I extract SQLs from the output (a.sql.txt)
and tried to reproduce the issue by source a.sql; but also failed.

@wshwsh12
Copy link
Contributor

/assign @lzmhhh123

@XuHuaiyu XuHuaiyu added sig/sql-infra SIG: SQL Infra and removed sig/execution SIG execution labels Apr 14, 2021
@XuHuaiyu XuHuaiyu assigned wjhuang2016 and unassigned lzmhhh123 Apr 14, 2021
@wjhuang2016
Copy link
Member

This the because the new cluster doesn't enable the new collation. After enabling the new collation, it gets the correct result.

@wjhuang2016 wjhuang2016 removed severity/major type/bug The issue is confirmed as a bug. labels Jul 21, 2021
@wjhuang2016
Copy link
Member

Not a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra
Projects
None yet
Development

No branches or pull requests

8 participants