Bug #75221 KILL should support thread_id from P_S
Description:
Performance schema thread_id's differ from the IDs in SHOW PROCESSLIST and KILL. They can be mapped by using the performance_schema.threads table:
mysql> SHOW CREATE TABLE performance_schema.threads\G
*************************** 1. row ***************************
Table: threads
Create Table: CREATE TABLE `threads` (
`THREAD_ID` bigint(20) unsigned NOT NULL, <-- thread ID in P_S
`NAME` varchar(128) NOT NULL,
`TYPE` varchar(10) NOT NULL,
`PROCESSLIST_ID` bigint(20) unsigned DEFAULT NULL, <-- thread id in PROCESSLIST and KILL
`PROCESSLIST_USER` varchar(16) DEFAULT NULL,
`PROCESSLIST_HOST` varchar(60) DEFAULT NULL,
`PROCESSLIST_DB` varchar(64) DEFAULT NULL,
`PROCESSLIST_COMMAND` varchar(16) DEFAULT NULL,
`PROCESSLIST_TIME` bigint(20) DEFAULT NULL,
`PROCESSLIST_STATE` varchar(64) DEFAULT NULL,
`PROCESSLIST_INFO` longtext,
`PARENT_THREAD_ID` bigint(20) unsigned DEFAULT NULL,
`ROLE` varchar(64) DEFAULT NULL,
`INSTRUMENTED` enum('YES','NO') NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
In my opinion, since PROCESSLIST can be replaced by SELECT * FROM sys.processlist; it should be possible for a DBA to do all of their administration using performance schema's native THREAD_IDs instead of PROCESSLIST_IDs.
Currently it's not possible to KILL by a THREAD_ID. It should be.
How to repeat:
Feature request
Suggested fix:
The manual says the current syntax for KILL is:
http://dev.mysql.com/doc/refman/5.7/en/kill.html
KILL [CONNECTION | QUERY] thread_id;
Technically I think it should be updated to:
KILL [CONNECTION | QUERY] processlist_id;
The command should also be enhanced to support PS thread IDs:
KILL [THREAD | PROCESSLIST] [CONNECTION | QUERY] id;
I would also recommend that examples in the manual prefer the use of KILL THREAD id; instead of KILL id.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Performance schema thread_id's differ from the IDs in SHOW PROCESSLIST and KILL. They can be mapped by using the performance_schema.threads table: mysql> SHOW CREATE TABLE performance_schema.threads\G *************************** 1. row *************************** Table: threads Create Table: CREATE TABLE `threads` ( `THREAD_ID` bigint(20) unsigned NOT NULL, <-- thread ID in P_S `NAME` varchar(128) NOT NULL, `TYPE` varchar(10) NOT NULL, `PROCESSLIST_ID` bigint(20) unsigned DEFAULT NULL, <-- thread id in PROCESSLIST and KILL `PROCESSLIST_USER` varchar(16) DEFAULT NULL, `PROCESSLIST_HOST` varchar(60) DEFAULT NULL, `PROCESSLIST_DB` varchar(64) DEFAULT NULL, `PROCESSLIST_COMMAND` varchar(16) DEFAULT NULL, `PROCESSLIST_TIME` bigint(20) DEFAULT NULL, `PROCESSLIST_STATE` varchar(64) DEFAULT NULL, `PROCESSLIST_INFO` longtext, `PARENT_THREAD_ID` bigint(20) unsigned DEFAULT NULL, `ROLE` varchar(64) DEFAULT NULL, `INSTRUMENTED` enum('YES','NO') NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 1 row in set (0.00 sec) In my opinion, since PROCESSLIST can be replaced by SELECT * FROM sys.processlist; it should be possible for a DBA to do all of their administration using performance schema's native THREAD_IDs instead of PROCESSLIST_IDs. Currently it's not possible to KILL by a THREAD_ID. It should be. How to repeat: Feature request Suggested fix: The manual says the current syntax for KILL is: http://dev.mysql.com/doc/refman/5.7/en/kill.html KILL [CONNECTION | QUERY] thread_id; Technically I think it should be updated to: KILL [CONNECTION | QUERY] processlist_id; The command should also be enhanced to support PS thread IDs: KILL [THREAD | PROCESSLIST] [CONNECTION | QUERY] id; I would also recommend that examples in the manual prefer the use of KILL THREAD id; instead of KILL id.