描述

    对于kill [connection] proceselist_id语句:

    • 可以kill指定proceselist_id的session。
    • 普通用户默认只能kill当前用户下所有session, 其他租户下session对其不可见,相同租户下其他用户的session的kill与否根据其当前租户权限确定。
    • observer的系统租户SYS可以kill本租户内任意一个session,proxy的超级管理员root@proxysys可以kill所有cluster、tenant下的session。

    示例

    1. OceanBase (root@oceanbase)> show processlist;
    2. +-------+--------+-------+----------------------+-----------+-------------+-------------------+-------------------+------+------+
    3. | Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
    4. +-------+--------+-------+----------------------+-----------+-------------+-------------------+-------------------+------+------+
    5. | 10004 | sys | root | 100.69.111.180:56777 | oceanbase | 68 | 1 | MCS_ACTIVE_READER | 2900 | 2891 |
    6. | 10006 | sys | admin | 10.125.111.4:33747 | oceanbase | 66 | 1 | MCS_KEEP_ALIVE | 2891 | 2891 |
    7. +-------+--------+-------+----------------------+-----------+-------------+-------------------+-------------------+------+------+
    8. 2 rows in set (0.01 sec)
    9. OceanBase (admin@oceanbase)> show processlist;
    10. +-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
    11. | Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
    12. +-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
    13. | 10006 | sys | admin | 10.125.111.4:33747 | oceanbase | 67 | 1 | MCS_ACTIVE_READER | 2891 | 2891 |
    14. +-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
    15. 1 row in set (0.01 sec)
    16. OceanBase (admin@oceanbase)> kill 10004;
    17. ERROR 1095 (HY000): You are not owner of thread 10004
    18. OceanBase (admin@oceanbase)> kill 1000;
    19. ERROR 1094 (HY000): Unknown thread id: 1000
    20. OceanBase (admin@oceanbase)> kill connection 1000;
    21. ERROR 1094 (HY000): Unknown thread id: 1000
    22. OceanBase (admin@oceanbase)> kill connection 10006;
    23. ERROR 1317 (70100): Query execution was interrupted
    24. OceanBase (admin@oceanbase)> show processlist;
    25. ERROR 2006 (HY000): MySQL server has gone away
    26. No connection. Trying to reconnect...
    27. Connection id: 10007
    28. Current database: oceanbase
    29. +-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
    30. | Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
    31. +-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
    32. | 10007 | sys | admin | 10.125.111.4:33864 | oceanbase | 65 | 1 | MCS_ACTIVE_READER | 2891 | 2891 |
    33. +-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
    34. 1 row in set (0.25 sec)
    1. OceanBase (test@proxysys@oceanbase)> show processlist;
    2. +-------+------------+-------+----------------------+-----------+-------------+-------------------+-------------------+------+------+
    3. | Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
    4. +-------+------------+-------+----------------------+-----------+-------------+-------------------+-------------------+------+------+
    5. | 10008 | proxysys | root | 100.69.111.180:56822 | NULL | 8 | 0 | MCS_ACTIVE_READER | 2900 | 2891 |
    6. | 10009 | sys | admin | 10.125.111.4:33980 | oceanbase | 65 | 1 | MCS_KEEP_ALIVE | 2891 | 2891 |
    7. +-------+------------+-------+----------------------+-----------+-------------+-------------------+-------------------+------+------+
    8. 2 rows in set (0.01 sec)
    9. OceanBase (admin@oceanbase)> show processlist;
    10. +-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
    11. | Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
    12. +-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
    13. | 10009 | sys | admin | 10.125.111.4:33980 | oceanbase | 66 | 1 | MCS_ACTIVE_READER | 2891 | 2891 |
    14. +-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
    15. 1 row in set (0.01 sec)
    16. OceanBase (admin@oceanbase)> kill 10008;
    17. ERROR 1094 (HY000): Unknown thread id: 10008