-
Notifications
You must be signed in to change notification settings - Fork 6k
server: return results of ongoing queries when graceful shutdown #19669
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
Conversation
Should cherry-pick to release-4.0 and release-3.0 manually. |
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.
Results of ongoing queries should be returned successfully when graceful shutdown.
This may affect the correctness! we can either return a full of data with success, or an error.
When the query is interrupted, we can not be sure the integrity of the data.
@@ -486,9 +486,6 @@ func (s *Server) ShowProcessList() map[uint64]*util.ProcessInfo { | |||
defer s.rwlock.RUnlock() | |||
rs := make(map[uint64]*util.ProcessInfo, len(s.clients)) | |||
for _, client := range s.clients { | |||
if atomic.LoadInt32(&client.status) == connStatusWaitShutdown { | |||
continue |
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.
Somebody once complained that he use kill tidb connection XXX
, but could still see the session in show processlist
.
Here is a fix for him.
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.
I think it should stay in processlist
because it is really running and not fully closed. Maybe we can show a closing
state for him.
The client will get a |
|
Graceful shutdown does not set the From the client's point of view, when the server enter graceful shutdown mode, it's better for the ongoing connection to reply a success before it's closed, rather than replying a interrupted error and close. |
LGTM |
@tiancaiamao, @lysu, @zz-jason, @qw4990, PTAL. |
2 similar comments
@tiancaiamao, @lysu, @zz-jason, @qw4990, PTAL. |
@tiancaiamao, @lysu, @zz-jason, @qw4990, PTAL. |
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.
how about adding some tests?
@tiancaiamao, @zz-jason, @lysu, @qw4990, PTAL. |
1 similar comment
@tiancaiamao, @zz-jason, @lysu, @qw4990, PTAL. |
@tiancaiamao, @zz-jason, @qw4990, @lysu, PTAL. |
There is no reward for this challenge pull request, so you can request a reward from @qw4990. |
@tiancaiamao, @zz-jason, @qw4990, @lysu, PTAL. |
@tiancaiamao, @zz-jason, @qw4990, PTAL. |
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.
Almost LGTM, Please add some tests.
@tiancaiamao, @zz-jason, @qw4990, PTAL. |
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
/merge |
/run-all-tests |
I prefer keeping it in |
@SunRunAway merge failed. |
@tiancaiamao, @zz-jason, @qw4990, @ti-srebot, PTAL. |
/merge |
/run-all-tests |
/run-all-tests |
@SunRunAway merge failed. |
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-4.0 in PR #21464 |
What problem does this PR solve?
Issue Number: close #19663
Problem Summary:
Got
Query execution was interrupted
when graceful shutdownWhat is changed and how it works?
Proposal: xxx
What's Changed:
Should not return
ErrQueryInterrupted
when server state isconnStatusWaitShutdown
. Results of ongoing queries should be returned successfully when graceful shutdown.How it Works:
Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Add an e2e test:
master:
This branch:
Release note