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: support a hint to force using a IndexMerge path #12843

Merged
merged 2 commits into from
Nov 27, 2019
Merged

planner: support a hint to force using a IndexMerge path #12843

merged 2 commits into from
Nov 27, 2019

Conversation

hailanwhu
Copy link
Contributor

What problem does this PR solve?

Support a hint to access a table using IndexMerge way.

What is changed and how it works?

It is just like the other hints.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change
    mainly change func (ds *DataSource) accessPathsForConds and func (ds *DataSource) DeriveStats

  • Has exported variable/fields change
    tableHintInfo adds the indexMergeHintList field.
    Datasource adds the indexMergeHint field.
    Side effects

  • Possible performance regression

  • Breaking backward compatibility

@sre-bot sre-bot added the contribution This PR is from a community contributor. label Oct 20, 2019
@codecov
Copy link

codecov bot commented Oct 20, 2019

Codecov Report

Merging #12843 into master will increase coverage by 0.0839%.
The diff coverage is 94.9367%.

@@               Coverage Diff                @@
##             master     #12843        +/-   ##
================================================
+ Coverage   80.0403%   80.1242%   +0.0839%     
================================================
  Files           474        474                
  Lines        116630     116695        +65     
================================================
+ Hits          93351      93501       +150     
+ Misses        15897      15805        -92     
- Partials       7382       7389         +7

@hailanwhu
Copy link
Contributor Author

@eurekaka, it failed to add the test for can't find proper plan. because if it returns a invalidTask, TiDB will generate an error for it and the explain test will fail.

@zz-jason zz-jason added the sig/planner SIG: Planner label Oct 21, 2019
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.

Could you also generate hints for index merge in GenHintsFromPhysicalPlan?

Copy link
Contributor

@eurekaka eurekaka left a comment

Choose a reason for hiding this comment

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

Also, I think we should update genHintsFromPhysicalPlan for index merge hint as well, @lamxTyler please confirm.

--

Oh, I just noticed Haibin had already commented about it.

cmd/explaintest/t/explain_indexmerge.test Show resolved Hide resolved
planner/core/find_best_task.go Outdated Show resolved Hide resolved
planner/core/stats.go Show resolved Hide resolved
planner/core/find_best_task.go Outdated Show resolved Hide resolved
@hailanwhu
Copy link
Contributor Author

@eurekaka all the comments are fixed.

planner/core/find_best_task.go Outdated Show resolved Hide resolved
planner/core/hints.go Outdated Show resolved Hide resolved
planner/core/stats.go Show resolved Hide resolved
planner/core/stats.go Outdated Show resolved Hide resolved
@hailanwhu
Copy link
Contributor Author

@eurekaka all comments are fixed.

planner/core/logical_plan_builder.go Outdated Show resolved Hide resolved
planner/core/stats.go Outdated Show resolved Hide resolved
planner/core/stats.go Outdated Show resolved Hide resolved
planner/core/stats.go Outdated Show resolved Hide resolved
planner/core/stats.go Show resolved Hide resolved
planner/core/stats.go Outdated Show resolved Hide resolved
planner/core/stats.go Outdated Show resolved Hide resolved
planner/core/find_best_task.go Outdated Show resolved Hide resolved
planner/core/stats.go Outdated Show resolved Hide resolved
sessionctx/stmtctx/stmtctx.go Outdated Show resolved Hide resolved
@hailanwhu
Copy link
Contributor Author

@eurekaka all done

Copy link
Contributor

@eurekaka eurekaka left a comment

Choose a reason for hiding this comment

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

LGTM

@eurekaka eurekaka added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 13, 2019
planner/core/stats.go Outdated Show resolved Hide resolved
planner/core/stats.go Outdated Show resolved Hide resolved
@hailanwhu
Copy link
Contributor Author

@eurekaka @lamxTyler this has been somedays. If it is ok, I can solve the conflict and push it again.

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
Please resolve the conflicts.

@CLAassistant
Copy link

CLAassistant commented Nov 27, 2019

CLA assistant check
All committers have signed the CLA.

@hailanwhu
Copy link
Contributor Author

@eurekaka @lamxTyler it is finished.

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/LGT2 Indicates that a PR has LGTM 2. status/can-merge Indicates a PR has been approved by a committer. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 27, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Nov 27, 2019

/run-all-tests

@sre-bot sre-bot merged commit 596fb64 into pingcap:master Nov 27, 2019
XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants