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

The _tidb_rowid is not correct when using index scan only #8131

Closed
jackysp opened this issue Nov 1, 2018 · 2 comments
Closed

The _tidb_rowid is not correct when using index scan only #8131

jackysp opened this issue Nov 1, 2018 · 2 comments
Labels
type/bug The issue is confirmed as a bug.

Comments

@jackysp
Copy link
Member

jackysp commented Nov 1, 2018

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
mysql> drop table t;
Query OK, 0 rows affected (0.02 sec)

mysql> create table t (i varchar(20) primary key);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t values ("a");
Query OK, 1 row affected (0.00 sec)

mysql> select _tidb_rowid from t;
+-------------+
| _tidb_rowid |
+-------------+
|           1 |
+-------------+
1 row in set (0.00 sec)

mysql> select _tidb_rowid from t use index (`primary`);
+-------------+
| _tidb_rowid |
+-------------+
|          97 |
+-------------+
1 row in set (0.00 sec)

mysql> explain select _tidb_rowid from t use index (`primary`);
+-------------------+-------+------+---------------------------------------------------------------------+
| id                | count | task | operator info                                                       |
+-------------------+-------+------+---------------------------------------------------------------------+
| IndexReader_5     | 1.00  | root | index:IndexScan_4                                                   |
| └─IndexScan_4     | 1.00  | cop  | table:t, index:i, range:[NULL,+inf], keep order:false, stats:pseudo |
+-------------------+-------+------+---------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> explain select _tidb_rowid from t;
+-------------------+-------+------+------------------------------------------------------------+
| id                | count | task | operator info                                              |
+-------------------+-------+------+------------------------------------------------------------+
| TableReader_5     | 1.00  | root | data:TableScan_4                                           |
| └─TableScan_4     | 1.00  | cop  | table:t, range:[-inf,+inf], keep order:false, stats:pseudo |
+-------------------+-------+------+------------------------------------------------------------+
2 rows in set (0.00 sec)
  1. What did you expect to see?
mysql> select _tidb_rowid from t use index (`primary`);
+-------------+
| _tidb_rowid |
+-------------+
|           1 |
+-------------+
1 row in set (0.00 sec)
  1. What did you see instead?
mysql> select _tidb_rowid from t use index (`primary`);
+-------------+
| _tidb_rowid |
+-------------+
|          97 |
+-------------+
1 row in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    d07e5fb
@jackysp jackysp added the type/bug The issue is confirmed as a bug. label Nov 1, 2018
@winoros
Copy link
Member

winoros commented Nov 1, 2018

This should be fixed in c23a30c by #8118

@jackysp
Copy link
Member Author

jackysp commented Nov 1, 2018

😯
I've checked the latest master. It's fixed.

@jackysp jackysp closed this as completed Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants