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: support global kill #17649

Merged
merged 70 commits into from
Oct 27, 2020
Merged

Conversation

pingyu
Copy link
Contributor

@pingyu pingyu commented Jun 3, 2020

What problem does this PR solve?

Issue Number: close #8854

Problem Summary:
Support CTRL-C or KILL to kill a connection/query.

What is changed and how it works?

Compose a global unique connection id by a unique server id and local unique connection id. See design doc for detail.

Related changes

Check List

Tests

  • Unit Test
  • Manual Test

[client on TiDB id:2002]

mysql root@localhost:information_schema> select * from cluster_info;                            
Reconnecting...
+------+-----------------+-----------------+--------------+------------------------------------------+---------------------------+------------------+-----------+
| TYPE | INSTANCE        | STATUS_ADDRESS  | VERSION      | GIT_HASH                                 | START_TIME                | UPTIME           | SERVER_ID |
+------+-----------------+-----------------+--------------+------------------------------------------+---------------------------+------------------+-----------+
| tidb | 127.0.0.1:4000  | 127.0.0.1:10080 | 4.0.0-beta.2 | 2fc30a6b5986e512ed7fda775c25ab7b3b38f55d | 2020-06-25T19:50:10+08:00 | 4m49.455269s     | 2001      |
| tidb | 127.0.0.1:4100  | 127.0.0.1:10180 | 4.0.0-beta.2 | 2fc30a6b5986e512ed7fda775c25ab7b3b38f55d | 2020-06-25T19:50:17+08:00 | 4m42.455272s     | 2002      |
| pd   | 127.0.0.1:2379  | 127.0.0.1:2379  | 4.1.0-alpha  | 4c132fdf9461388555facaaf994b4d0253057bf3 | 2020-06-25T17:32:16+08:00 | 2h22m43.455274s  | 0         |
| tikv | 127.0.0.1:20160 | 127.0.0.1:20180 | 4.1.0-alpha  | 4ec9476a7a4fec296c49c26feac4702a02645d54 | 2020-06-24T00:14:22+08:00 | 43h40m37.45528s  | 0         |
| tikv | 127.0.0.1:20161 | 127.0.0.1:20180 | 4.1.0-alpha  | 4ec9476a7a4fec296c49c26feac4702a02645d54 | 2020-06-24T00:14:21+08:00 | 43h40m38.455282s | 0         |
| tikv | 127.0.0.1:20162 | 127.0.0.1:20180 | 4.1.0-alpha  | 4ec9476a7a4fec296c49c26feac4702a02645d54 | 2020-06-24T00:14:21+08:00 | 43h40m38.455283s | 0         |
+------+-----------------+-----------------+--------------+------------------------------------------+---------------------------+------------------+-----------+
6 rows in set
Time: 0.016s
mysql root@localhost:information_schema> select sleep(60);                                      
+-----------+
| sleep(60) |
+-----------+
| 1         |
+-----------+
1 row in set
Time: 9.266s
mysql root@localhost:information_schema>  

[client on TiDB id:2001]

mysql root@localhost:information_schema> select * from cluster_info;                                                                     
+------+-----------------+-----------------+--------------+------------------------------------------+---------------------------+------------------+-----------+
| TYPE | INSTANCE        | STATUS_ADDRESS  | VERSION      | GIT_HASH                                 | START_TIME                | UPTIME           | SERVER_ID |
+------+-----------------+-----------------+--------------+------------------------------------------+---------------------------+------------------+-----------+
| tidb | 127.0.0.1:4000  | 127.0.0.1:10080 | 4.0.0-beta.2 | 2fc30a6b5986e512ed7fda775c25ab7b3b38f55d | 2020-06-25T19:50:10+08:00 | 5m3.702615s      | 2001      |
| tidb | 127.0.0.1:4100  | 127.0.0.1:10180 | 4.0.0-beta.2 | 2fc30a6b5986e512ed7fda775c25ab7b3b38f55d | 2020-06-25T19:50:17+08:00 | 4m56.702619s     | 2002      |
| pd   | 127.0.0.1:2379  | 127.0.0.1:2379  | 4.1.0-alpha  | 4c132fdf9461388555facaaf994b4d0253057bf3 | 2020-06-25T17:32:16+08:00 | 2h22m57.70262s   | 0         |
| tikv | 127.0.0.1:20160 | 127.0.0.1:20180 | 4.1.0-alpha  | 4ec9476a7a4fec296c49c26feac4702a02645d54 | 2020-06-24T00:14:22+08:00 | 43h40m51.702622s | 0         |
| tikv | 127.0.0.1:20161 | 127.0.0.1:20180 | 4.1.0-alpha  | 4ec9476a7a4fec296c49c26feac4702a02645d54 | 2020-06-24T00:14:21+08:00 | 43h40m52.702623s | 0         |
| tikv | 127.0.0.1:20162 | 127.0.0.1:20180 | 4.1.0-alpha  | 4ec9476a7a4fec296c49c26feac4702a02645d54 | 2020-06-24T00:14:21+08:00 | 43h40m52.702626s | 0         |
+------+-----------------+-----------------+--------------+------------------------------------------+---------------------------+------------------+-----------+
6 rows in set
Time: 0.017s
mysql root@localhost:information_schema> select * from CLUSTER_PROCESSLIST                                                               
+-----------------+------------------+------+------+--------------------+---------+------+------------+-----------------------------------+-----+----------------------------------------+
| INSTANCE        | ID               | USER | HOST | DB                 | COMMAND | TIME | STATE      | INFO                              | MEM | TxnStart                               |
+-----------------+------------------+------+------+--------------------+---------+------+------------+-----------------------------------+-----+----------------------------------------+
| 127.0.0.1:10080 | 4400245534359557 | root | ::1  | information_schema | Query   | 0    | autocommit | select * from CLUSTER_PROCESSLIST | 0   | 06-25 19:55:19.366(417617967675080706) |
| 127.0.0.1:10180 | 4402444557615113 | root | ::1  | information_schema | Query   | 1    | autocommit | select sleep(60)                  | 0   |                                        |
+-----------------+------------------+------+------+--------------------+---------+------+------------+-----------------------------------+-----+----------------------------------------+
2 rows in set
Time: 0.016s
mysql root@localhost:information_schema> kill 4402444557615113;                                                                          
Query OK, 0 rows affected
Time: 0.001s
mysql root@localhost:information_schema>  

Release note

  • Support KILL <connectionID> across the whole cluster.

@sre-bot sre-bot added the contribution This PR is from a community contributor. label Jun 3, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Jun 3, 2020

@sre-bot
Copy link
Contributor

sre-bot commented Jun 6, 2020


1. Extend connection ids from 32 to 64 bits would break some clients. Main current clients need to be checked for compatibility.

2. Some clients would probably send `KILL` command with 32 bits connection ids. We should deal with this circumstance. (Ref. [1](https://github.com/pingcap/tidb/issues/8854#issuecomment-637217000) [2](https://github.com/pingcap/tidb/issues/8854#issuecomment-637237183))
Copy link
Member

Choose a reason for hiding this comment

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

I suggest to leave some space discuss about mysql-client Ctrl+C compatibility. We don't need to give solutions in this RFC and we will resolve it later by introducing another RFC specifically for further introducing a 32 bit global connection id for small clusters.

@sre-bot
Copy link
Contributor

sre-bot commented Jun 14, 2020

1 similar comment
@sre-bot
Copy link
Contributor

sre-bot commented Jun 14, 2020

@pingyu pingyu requested a review from a team as a code owner June 21, 2020 16:54
@pingyu pingyu requested review from qw4990 and removed request for a team June 21, 2020 16:54
@github-actions github-actions bot added sig/sql-infra SIG: SQL Infra sig/execution SIG execution labels Jun 21, 2020
ti-srebot
ti-srebot previously approved these changes Oct 26, 2020
@breezewish
Copy link
Member

Please resolve conflicts, thanks!

@pingyu pingyu dismissed stale reviews from ti-srebot, SunRunAway, and breezewish via e893ab4 October 26, 2020 15:05
@pingyu
Copy link
Contributor Author

pingyu commented Oct 26, 2020

/run-all-tests

@pingyu
Copy link
Contributor Author

pingyu commented Oct 27, 2020

Conflicts resolved.

idc-jenkins-ci-tidb/unit-test failed in TestClusterIndexAnalyze, which failed in master, too. It seems to be not relevant to do this PR. I'm looking for the cause.

@breezewish
Copy link
Member

/merge

@ti-srebot
Copy link
Contributor

@breeswish Oops! auto merge is restricted to Committers of the SIG.See the corresponding SIG page for more information. Related SIGs: execution(slack),ddl(slack).

@SunRunAway
Copy link
Contributor

/merge

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

/run-all-tests

@ti-srebot
Copy link
Contributor

@pingyu merge failed.

@SunRunAway
Copy link
Contributor

/merge

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@pingyu merge failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/config component/executor contribution This PR is from a community contributor. sig/execution SIG execution sig/sql-infra SIG: SQL Infra status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support CTRL-C or kill <connId> to kill a connection/query by implementing global connection IDs
7 participants