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: fix bug cost model for tiflash do not work #13111

Merged
merged 6 commits into from
Nov 4, 2019

Conversation

lzmhhh123
Copy link
Contributor

@lzmhhh123 lzmhhh123 commented Nov 4, 2019

What problem does this PR solve?

As the title says.

What is changed and how it works?

Decouple the logic with hint read_from_storage.

Check List

Tests

  • Unit test
  • Integration test

A simple test for after the PR:

tidb(localhost:4001) > create table t (a int, b int, c int, primary key(a));
Query OK, 0 rows affected (1.04 sec)

tidb(localhost:4001) > insert into t values(1,1,1),(2,2,2),(3,3,4);
Query OK, 3 rows affected (0.02 sec)
Records: 3  Duplicates: 0  Warnings: 0

tidb(localhost:4001) > alter table t set tiflash replica 1 location labels 'rack', 'host', 'abc';
Query OK, 0 rows affected (1.03 sec)

tidb(localhost:4001) > desc select * from t;
+-------------------+-------+--------------+----------------------------------------------+
| id                | count | task         | operator info                                |
+-------------------+-------+--------------+----------------------------------------------+
| TableReader_7     | 3.00  | root         | data:TableScan_6                             |
| └─TableScan_6     | 3.00  | cop[tiflash] | table:t, range:[-inf,+inf], keep order:false |
+-------------------+-------+--------------+----------------------------------------------+
2 rows in set (0.00 sec)

tidb(localhost:4001) > desc select * from t where t.a = 1 or t.a = 2;
+-------------------+-------+-----------+-----------------------------------------------+
| id                | count | task      | operator info                                 |
+-------------------+-------+-----------+-----------------------------------------------+
| TableReader_6     | 1.50  | root      | data:TableScan_5                              |
| └─TableScan_5     | 1.50  | cop[tikv] | table:t, range:[1,1], [2,2], keep order:false |
+-------------------+-------+-----------+-----------------------------------------------+
2 rows in set (0.00 sec)

tidb(localhost:4001) > set @@session.tidb_isolation_read_engines="tiflash";
Query OK, 0 rows affected (0.00 sec)

tidb(localhost:4001) > desc select * from t where t.a = 1 or t.a = 2;
+---------------------+-------+--------------+----------------------------------------------+
| id                  | count | task         | operator info                                |
+---------------------+-------+--------------+----------------------------------------------+
| TableReader_7       | 1.50  | root         | data:Selection_6                             |
| └─Selection_6       | 1.50  | cop[tiflash] | or(eq(Column#1, 1), eq(Column#1, 2))         |
|   └─TableScan_5     | 1.50  | cop[tiflash] | table:t, range:[-inf,+inf], keep order:false |
+---------------------+-------+--------------+----------------------------------------------+
3 rows in set (0.00 sec)

@lzmhhh123 lzmhhh123 added sig/planner SIG: Planner type/bugfix This PR fixes a bug. labels Nov 4, 2019
@codecov
Copy link

codecov bot commented Nov 4, 2019

Codecov Report

Merging #13111 into master will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##            master    #13111   +/-   ##
=========================================
  Coverage   80.174%   80.174%           
=========================================
  Files          468       468           
  Lines       110557    110557           
=========================================
  Hits         88638     88638           
  Misses       15136     15136           
  Partials      6783      6783

Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

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

Can we add a test?

@lzmhhh123
Copy link
Contributor Author

@lamxTyler Test was added.

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

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

LGTM

@alivxxx alivxxx added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. labels Nov 4, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Nov 4, 2019

/run-all-tests

@sre-bot sre-bot merged commit 96757aa into pingcap:master Nov 4, 2019
@lzmhhh123 lzmhhh123 deleted the bug-fix/cost_model_of_tiflash branch November 4, 2019 07:47
XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
lzmhhh123 added a commit to lzmhhh123/tidb that referenced this pull request Jan 19, 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants