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: enforce projection push down #25450

Merged
merged 8 commits into from
Jun 22, 2021

Conversation

fzhedu
Copy link
Contributor

@fzhedu fzhedu commented Jun 15, 2021

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary: if enforced MPP, we push down projection to tiflash.

What is changed and how it works?

Proposal: xxx

What's Changed:

How it Works:

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Integration test

Release note

  • No release note

@fzhedu fzhedu requested a review from a team as a code owner June 15, 2021 12:23
@fzhedu fzhedu requested review from hanfei1991 and removed request for a team June 15, 2021 12:23
@ti-chi-bot ti-chi-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 15, 2021
@fzhedu fzhedu requested a review from LittleFall June 15, 2021 12:29
@fzhedu fzhedu requested a review from a team as a code owner June 16, 2021 04:26
@fzhedu fzhedu requested review from lzmhhh123 and removed request for a team June 16, 2021 04:26
@github-actions github-actions bot added the sig/execution SIG execution label Jun 16, 2021
@fzhedu fzhedu requested a review from qw4990 June 16, 2021 04:36
@@ -380,7 +380,7 @@ func (s *tiflashTestSuite) TestTiFlashPartitionTableReader(c *C) {

tk.MustExec("SET tidb_enforce_mpp=1")
tk.MustExec("set @@session.tidb_isolation_read_engines='tiflash'")
for i := 0; i < 100; i++ {
for i := 0; i < 10; i++ {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

before this PR, this test do not run in MPP. after this PR, this test timeout, so reduce the running times.

@fzhedu
Copy link
Contributor Author

fzhedu commented Jun 16, 2021

/run-all-tests

return []PhysicalPlan{proj}, true, nil
newProps := []*property.PhysicalProperty{newProp}
// generate a mpp task candidate if enforced mpp
if newProp.TaskTp != property.MppTaskType && p.SCtx().GetSessionVars().IsMPPEnforced() {
Copy link
Member

Choose a reason for hiding this comment

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

better to check "canPushDownToCop(TiFlash)"

Copy link
Member

Choose a reason for hiding this comment

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

It can avoid some plan id changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, by the way, should we consider whether expressions can push down?

"explain format='verbose' select count(*) from t where a=1",
"explain format='verbose' select /*+ read_from_storage(tikv[t]) */ count(*) from t where a=1",
"explain format='verbose' select /*+ read_from_storage(tiflash[t]) */ count(*) from t where a=1",
"explain format = 'brief' select count(*) from t where a=1",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@LittleFall can I change this? because it binds the id of each operator, which will be changed in future due to other PRs.

Copy link
Contributor

Choose a reason for hiding this comment

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

I set format='verbose' to check that the task cost is reduced by enforce_mpp. So I suggest keeping verbose in the test suite TestEnforceMPP, and use format='brief' to check other tests.

Copy link
Contributor

@LittleFall LittleFall left a comment

Choose a reason for hiding this comment

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

lgtm

"explain format='verbose' select count(*) from t where a=1",
"explain format='verbose' select /*+ read_from_storage(tikv[t]) */ count(*) from t where a=1",
"explain format='verbose' select /*+ read_from_storage(tiflash[t]) */ count(*) from t where a=1",
"explain format = 'brief' select count(*) from t where a=1",
Copy link
Contributor

Choose a reason for hiding this comment

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

I set format='verbose' to check that the task cost is reduced by enforce_mpp. So I suggest keeping verbose in the test suite TestEnforceMPP, and use format='brief' to check other tests.

@ti-chi-bot
Copy link
Member

@LittleFall: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot removed the sig/execution SIG execution label Jun 18, 2021
@ti-chi-bot ti-chi-bot added status/LGT1 Indicates that a PR has LGTM 1. sig/execution SIG execution and removed sig/execution SIG execution labels Jun 18, 2021
@qw4990 qw4990 removed their request for review June 21, 2021 03:30
return []PhysicalPlan{proj}, true, nil
newProps := []*property.PhysicalProperty{newProp}
// generate a mpp task candidate if enforced mpp
if newProp.TaskTp != property.MppTaskType && p.SCtx().GetSessionVars().IsMPPEnforced() && p.canPushToCop(kv.TiFlash) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a very hack code here. Can we find the root cause why properties don't contain MppTaskType? These generated plans are dangerous with force MPP type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if projection is the top operator, we should add a option of MPPTaskType. it is not dangenous, because in the physical phase, if it cannot satisfy MPPTaskType, it only generates root tasks.

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • LittleFall
  • hanfei1991

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 22, 2021
@fzhedu
Copy link
Contributor Author

fzhedu commented Jun 22, 2021

/run-all-tests

@fzhedu
Copy link
Contributor Author

fzhedu commented Jun 22, 2021

/run-check_dev_2

@fzhedu
Copy link
Contributor Author

fzhedu commented Jun 22, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 3dbd838

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 22, 2021
@fzhedu
Copy link
Contributor Author

fzhedu commented Jun 22, 2021

/run-check_dev_2

@ti-chi-bot ti-chi-bot merged commit 9ca449b into pingcap:master Jun 22, 2021
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jun 24, 2021
@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #25740

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jun 24, 2021
@ti-srebot
Copy link
Contributor

cherry pick to release-5.1 in PR #25741

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.0 needs-cherry-pick-release-5.1 sig/execution SIG execution size/L Denotes a PR that changes 100-499 lines, ignoring generated files. 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