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

server: handle kill signal during write result to connection #52882

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

wshwsh12
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #44009

Problem Summary:

What changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Copy link

ti-chi-bot bot commented Apr 25, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign bornchanger for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 25, 2024
Copy link

tiprow bot commented Apr 25, 2024

Hi @wshwsh12. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions 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 kubernetes/test-infra repository.

@wshwsh12
Copy link
Contributor Author

Manual test

  1. Create table t with one int column, and insert 1-8388608.
  2. set @@global.tidb_enable_tmp_storage_on_oom = off; and set @@global.tidb_mem_quota_query = 5 << 30;
  3. Use go-mysql-driver to query the sql "select count(1) from t group by a;", fetch 10000 rows and hang forever.
  4. Wait 10 minutes and sql doesn't finished.
  5. Create another session and try to kill query. kill tidb query xxxxxxxxx.
  6. The memory usage is released. After the client is restored, other sql can still be queried.
    image
tidb> kill tidb query 2631925768;
Query OK, 0 rows affected (0.00 sec)

tidb> show processlist;
+------------+------+-----------------+------+---------+------+---------------------------------+-----------------------------------+
| Id         | User | Host            | db   | Command | Time | State                           | Info                              |
+------------+------+-----------------+------+---------+------+---------------------------------+-----------------------------------+
| 2631925766 | root | 127.0.0.1:35256 | test | Query   |    0 | autocommit                      | show processlist                  |
| 2631925768 | root | 127.0.0.1:37406 | test | Query   |  516 | autocommit; wait query finished | select count(1) from t group by a |
+------------+------+-----------------+------+---------+------+---------------------------------+-----------------------------------+
2 rows in set (0.00 sec)

@wshwsh12
Copy link
Contributor Author

/ok-to-test

Copy link

codecov bot commented Apr 25, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 55.0839%. Comparing base (896afa7) to head (695292d).
Report is 1 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #52882         +/-   ##
=================================================
- Coverage   72.3871%   55.0839%   -17.3033%     
=================================================
  Files          1480       1594        +114     
  Lines        428351     600789     +172438     
=================================================
+ Hits         310071     330938      +20867     
- Misses        99029     247552     +148523     
- Partials      19251      22299       +3048     
Flag Coverage Δ
integration 35.3845% <66.6666%> (?)
unit 71.1993% <66.6666%> (-0.0656%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 41.5890% <ø> (+0.3815%) ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test release-note-none size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kill statement can't work and write result to conn takes a lot of time
1 participant