Skip to content

planner: fix stream agg pushed down to mpp plan unexpectedly#32752

Merged
ti-chi-bot merged 10 commits into
pingcap:masterfrom
time-and-fate:issue32632
Mar 3, 2022
Merged

planner: fix stream agg pushed down to mpp plan unexpectedly#32752
ti-chi-bot merged 10 commits into
pingcap:masterfrom
time-and-fate:issue32632

Conversation

@time-and-fate
Copy link
Copy Markdown
Member

@time-and-fate time-and-fate commented Mar 2, 2022

Issue Number: close #32632

Problem Summary:

In (*PhysicalStreamAgg).attach2Task(), we didn't consider that it's possible that the task could be an mpp task even though we don't want an mpp task.
Most times this would not happen, but it's possible when tidb_enforce_mpp is turned on. (reference: #25450: https://github.com/pingcap/tidb/pull/25450/files#diff-d3d0144d9fe67ce1ca77fb02c6ebb7895cade0809e47b21b926bfa29feb0efb2)

When this happened, the mpp task is still considered as a root task, then the stream agg will be put directly on the plan tree of the task. This will essentially push the stream agg to the mpp task without remaining a phase 2 agg in the tidb side.

What is changed and how it works?

Add a check for mpp task in (*PhysicalStreamAgg).attach2Task(), finish the mpp part of the plan tree and remain the stream agg in the tidb side, and avoid unexpectedly pushing stream agg down to a mpp task.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

@ti-chi-bot
Copy link
Copy Markdown
Member

ti-chi-bot commented Mar 2, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • winoros
  • xuyifangreeneyes

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.

Details

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 release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 2, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 3, 2022
@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 Mar 3, 2022
@time-and-fate
Copy link
Copy Markdown
Member Author

/merge

@ti-chi-bot
Copy link
Copy Markdown
Member

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

DetailsCommit hash: d9a3f35

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 3, 2022
@time-and-fate
Copy link
Copy Markdown
Member Author

/run-unit-test

Copy link
Copy Markdown
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

@time-and-fate
Copy link
Copy Markdown
Member Author

/run-unit-test

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Mar 3, 2022
@time-and-fate
Copy link
Copy Markdown
Member Author

/merge

@ti-chi-bot
Copy link
Copy Markdown
Member

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

DetailsCommit hash: af93d6e

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 3, 2022
@ti-chi-bot
Copy link
Copy Markdown
Member

@time-and-fate: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Details

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.

@time-and-fate
Copy link
Copy Markdown
Member Author

/run-unit-test

@sre-bot
Copy link
Copy Markdown
Contributor

sre-bot commented Mar 3, 2022

@ti-chi-bot ti-chi-bot merged commit 41c1cc9 into pingcap:master Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 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.

Encounter Error 1242: Subquery returns more than 1 row when running TPCH Q11 with tidb_enforce_mpp=1

6 participants