planner: fix stream agg pushed down to mpp plan unexpectedly#32752
Conversation
|
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. DetailsReviewer can indicate their review by submitting an approval review. |
|
/merge |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: d9a3f35 |
|
/run-unit-test |
|
/run-unit-test |
|
/merge |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: af93d6e |
|
@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. DetailsInstructions 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. |
|
/run-unit-test |
|
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/e0e1aa5c796cd899a57899e27d26189179507182 |
Issue Number: close #32632
Problem Summary:
In
(*PhysicalStreamAgg).attach2Task(), we didn't consider that it's possible that thetaskcould 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_mppis 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
Side effects
Documentation
Release note