-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
executor: kill tidb [session id]
can't stop executors and release resources quickly
#9844
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9844 +/- ##
================================================
+ Coverage 77.2161% 78.1214% +0.9053%
================================================
Files 405 405
Lines 81641 85330 +3689
================================================
+ Hits 63040 66661 +3621
+ Misses 13931 13861 -70
- Partials 4670 4808 +138 |
@qw4990 maybe we can pull this watcher goroutine "up" to connection level~? for current code, it will create a new goroutine for each stmt but maybe better just create one watcher goroutine per connection? Line 706 in a2d4bd1
withCancel for each request?
cc @tiancaiamao |
Why we need a additional watcher to do that... each executor should handle its |
@tiancaiamao Each executor can also handle this |
I doubt this assumption, could we close the executor multiple times?
And poor performance if we add a goroutine for each statement |
But if all executors watch the context by themselves, there will be more extra goroutines than this one. So how about we don't let other executors watch it and just use this global goroutine to control them all. |
The watcher goroutine is not the key point. The fundamental problem is that CAN WE CALL In the old protocol, executor handle the If |
I'm afraid that
|
Sure, we can |
It's hard to get other sessions' resources like
All calls of |
The watcher is doing the same thing, right?
No, it's easy to set the cancel function (which is changed to And when one session receive the kill statement, it executes the cancelFunc ( actually |
According to your comments, the way to solve this problem has been changed. |
Rest 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
/run-all-tests |
@qw4990 please cherry pick this PR to release 2.1 |
…esources quickly (pingcap#9844)
What problem does this PR solve?
fix #9831
What is changed and how it works?
Introduce
execCtxWatcher
to watch the context specified inOpen
and stop the wrapped executor when this context is cancelled.Check List
Tests