Skip to content
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 tableReader for each connection correctly (#18277) #18505

Merged
merged 5 commits into from
Jul 15, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #18277 to release-4.0


What problem does this PR solve?

Issue Number: close a part of #18057

Problem Summary:
The tableReader in the coprocessor may retry many times to read regions, druing which, it cannot be aware of the cancelation from client. It may take much of memory for a long time.

What is changed and how it works?

Proposal: detect Killed to stop the goroutine.

What's Changed: should not use CompareAndSwap to change the Killed before Close(), because many runninig goroutines should detect the Killed.

How it Works: the TableReader the detect the killed in every loop.
The query may not exit quickly, because the query do some close work.

Check List

Tests

  • Integration test
  • Manual test (add detailed scripts or steps below)
    test on mocktikv:
step1. explain analyze select * from lineitem;
step2. kill tidb sessionID on another client;
to see the connection is cancelled.

similarly test on TiFlash is ok.

Release note

  • To speed up canceling a query

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@fzhedu please accept the invitation then you can push to the cherry-pick pull requests.
https://github.com/ti-srebot/tidb/invitations

@fzhedu
Copy link
Contributor

fzhedu commented Jul 13, 2020

/rebuild

1 similar comment
@fzhedu
Copy link
Contributor

fzhedu commented Jul 13, 2020

/rebuild

Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 13, 2020
@fzhedu
Copy link
Contributor

fzhedu commented Jul 14, 2020

/run-unit-test

Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 15, 2020
@SunRunAway
Copy link
Contributor

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 15, 2020
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@ti-srebot merge failed.

@SunRunAway
Copy link
Contributor

/merge

@ti-srebot
Copy link
Contributor Author

Your auto merge job has been accepted, waiting for:

  • 17907
  • 17907

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@SunRunAway SunRunAway merged commit fa9dd0a into pingcap:release-4.0 Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants