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

planner: check readEngines when building plan for index hint (#15723) #15773

Merged
merged 3 commits into from
Mar 30, 2020

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Mar 27, 2020

cherry-pick #15723 to release-3.1


What problem does this PR solve?

Issue Number: close #15494

Problem Summary: set @@session.tidb_isolation_read_engines='tiflash'; and use index can't get correct error information.

What is changed and how it works?

What's Changed: Check ReadEngines whether has TiKV when building an indexScan.

How it Works:

Related changes

  • Need to cherry-pick to the release branch 4.0

Check List

Tests

  • Manual test (add detailed scripts or steps below)
mysql> drop table t;
Query OK, 0 rows affected (0.19 sec)

mysql> create table t(a int, index idx(a));
Query OK, 0 rows affected (0.07 sec)

mysql> ALTER TABLE t SET TIFLASH REPLICA 1;
Query OK, 0 rows affected (0.07 sec)

mysql> set @@session.tidb_isolation_read_engines='tiflash';
Query OK, 0 rows affected (0.00 sec)

mysql> select * from t use index(idx);
ERROR 1176 (42000): Key 'idx' doesn't exist in table 't'
mysql> select /*+ use_index(t, idx)*/ * from t;
Empty set, 1 warning (0.01 sec)

mysql> show warnings;
+---------+------+--------------------------------------+
| Level   | Code | Message                              |
+---------+------+--------------------------------------+
| Warning | 1176 | Key 'idx' doesn't exist in table 't' |
+---------+------+--------------------------------------+
1 row in set (0.00 sec)

mysql> desc select /*+ use_index(t, idx)*/ * from t;
+-----------------------+----------+--------------+-----------------------------------------+
| id                    | estRows  | task         | operator info                           |
+-----------------------+----------+--------------+-----------------------------------------+
| TableReader_5         | 10000.00 | root         | data:TableFullScan_4                    |
| └─TableFullScan_4     | 10000.00 | cop[tiflash] | table:t, keep order:false, stats:pseudo |
+-----------------------+----------+--------------+-----------------------------------------+
2 rows in set, 1 warning (0.00 sec)

Side effects

Release note

Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor Author

sre-bot commented Mar 27, 2020

/run-all-tests

Copy link
Contributor

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lzmhhh123 lzmhhh123 added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 27, 2020
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zz-jason zz-jason added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 30, 2020
@sre-bot
Copy link
Contributor Author

sre-bot commented Mar 30, 2020

Your auto merge job has been accepted, waiting for 15678

@sre-bot
Copy link
Contributor Author

sre-bot commented Mar 30, 2020

/run-all-tests

@sre-bot sre-bot merged commit c85d8d7 into pingcap:release-3.1 Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug. type/3.1-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants