-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Fix forever hanging when HashAgg is called by apply (#12760) #12769
Fix forever hanging when HashAgg is called by apply (#12760) #12769
Conversation
I've dropped the unit test because it does not support sql hint for hashagg in this branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry @XuHuaiyu, you don't have permission to trigger auto merge event on this branch. |
Your auto merge job has been accepted, waiting for 12765, 12766 |
…upstream-release-2.1
/run-all-tests |
Automated cherry pick of #12760 on release-2.1.
What problem does this PR solve?
Fix #12759
What is changed and how it works?
The parent executors(apply) of HashAgg may call
HashAgg.Next
once more to make sure the returned size of chunk is 0.HashAgg.Next
handle these calls incorrectly after its allfinalWorks
exits.On each call of
HashAgg.Next
after the job done, it returns a chunk with 0 size, but put a chk intofinalInputCh
. Each apply executor will call aHashAgg.Next
once more, when the number of parent executors exceeds the channel buffer, the query will hang forever.Explain the example in #12759,
HashAgg.Next
which returns a one-row chunk to its parent, sends the chunk into the buffer (This is valid).HashAgg.Next
called by each of the three apply, which returns a zero-row chunk to its parent, sends the chunk into the buffer (This should not happen).HashAgg.Next
called by the session of tidb, which returns a zero-row chunk to its parent, sends the chunk into the buffer and hangs forever.Check List
Tests
Code changes
Side effects
Related changes
Release note