描述
对于kill query proceselist_id
语句:
- 可以kill query掉指定proceselist_id的session
- 普通用户默认只能kill query当前用户下所有session, 其他租户下session对其不可见,相同租户下其他用户的session的kill query与否根据其当前租户权限确定.
- observer的SYS租户可kill query本租户内任意一个session
以下三种情况时将不支持kill query,返回
ERROR 1235 (0A000): Not supported feature or function
:处于事务中时,例如,begin。
- 当前sql依赖上一条sql执行结果时,如
select found_rows()
/select row_count()
/show errors
/show warnings
等。 - 已经指定下一条transaction特性时,如
set transaction xxx
。
示例
OceanBase (admin@oceanbase)> show processlist;
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
| Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
| 10017 | sys | admin | 10.125.111.4:34628 | oceanbase | 67 | 1 | MCS_ACTIVE_READER | 2891 | 2891 |
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
1 row in set (0.01 sec)
OceanBase (admin@oceanbase)> select * from __all_core_table join ob_all_proxy_config;
^Ccatch sig: 2
Ctrl-C -- sending "KILL QUERY 10017" to server ...
Ctrl-C -- query aborted.
ERROR 1317 (70100): Query execution was interrupted
OceanBase (admin@oceanbase)> show processlist;
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
| Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
| 10017 | sys | admin | 10.125.111.4:34628 | oceanbase | 69 | 1 | MCS_ACTIVE_READER | 2891 | 2891 |
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
1 row in set (0.01 sec)
OceanBase (sqluser01@(none))> show processlist;
+-------+--------+-----------+----------------------+------+-------------+-------------------+-------------------+------+------+
| Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
+-------+--------+-----------+----------------------+------+-------------+-------------------+-------------------+------+------+
| 10020 | sys | sqluser01 | 100.69.197.111:56934 | NULL | 5 | 1 | MCS_ACTIVE_READER | 2900 | 2891 |
+-------+--------+-----------+----------------------+------+-------------+-------------------+-------------------+------+------+
1 row in set (0.01 sec)
OceanBase (sqluser01@(none))> kill query 10017;
ERROR 1227 (42501): Access denied; you need (at least one of) the SUPER privilege(s) for this operation
OceanBase (admin@oceanbase)> begin;
Query OK, 0 rows affected (0.00 sec)
OceanBase (admin@oceanbase)> show tables;
+------------------------------------+
| Tables_in_oceanbase |
+------------------------------------+
| ob_all_proxy |
| ob_all_proxy_config |
| ob_all_proxy_kv_table |
| ob_all_proxy_stat |
| ob_all_proxy_vip_tenant_table |
+------------------------------------+
5 rows in set (0.01 sec)
OceanBase (admin@oceanbase)> kill query 10021;
ERROR 1235 (0A000): Not supported feature or function
OceanBase (admin@oceanbase)> commit;
Query OK, 0 rows affected (0.01 sec)
OceanBase (admin@oceanbase)> set transaction read only;
Query OK, 0 rows affected (0.00 sec)
OceanBase (admin@oceanbase)> kill query 10021;
ERROR 1235 (0A000): Not supported feature or function