问题描述
按照对应3.1.3社区版的OBProxy官方文档描述的使用kill proxysession id的方式杀掉普通会话报错 ID不存在.
环境信息
root@127.0.0.1[oceanbase]> \s
--------------
obclient Ver 15.1 Distrib 10.4.18-MariaDB, for Linux (x86_64) using readline 5.1
Connection id: 1048601
Current database: oceanbase
Current user: root@127.0.0.1
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server: MySQL
Server version: 5.6.25 OceanBase 3.1.3 (r10100032022041510-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built Apr 15 2022 02:16:22)
Protocol version: 10
Connection: 127.0.0.1 via TCP/IP
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
TCP port: 2883
Active --------------
## OBProxy 版本信息
root@127.0.0.1[oceanbase]> show proxyinfo binary\G
*************************** 1. row ***************************
name: binary info
info: ObProxy-OceanBase 3.2.0-1
version:RELEASE_UNKNOWN
MD5:
REVISION:58-local-b91a4006ba52e107d1a3edb03a50f3d14ef63cd8
BUILD_TIME:Nov 3 2021 06:51:33
BUILD_FLAGS:-g -O2 -D_OB_VERSION=1000 -D_NO_EXCEPTION -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DNDEBUG -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Wall -Wextra -Wunused-parameter -Wformat -Wconversion -Wno-deprecated -Wno-invalid-offsetof -finline-functions -fno-strict-aliasing -mtune=core2 -Wno-psabi -Wno-sign-compare -DGCC_52 -DSUPPORT_SSE4_2 -DHAVE_SCHED_GETCPU -DHAVE_REALTIME_COARSE -DOB_HAVE_EVENTFD -DHAVE_FALLOCATE -Werror
1 row in set (0.004 sec)
复现步骤
## 查看当前的连接, OBProxy的查看方式
root@127.0.0.1[oceanbase]> show proxysession;
+--------------+---------+----------+----------+------+---------------------+-----------+-------------+-------------------+-------------------+------+------+
| proxy_sessid | Id | Cluster | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
+--------------+---------+----------+----------+------+---------------------+-----------+-------------+-------------------+-------------------+------+------+
| 97 | 1048601 | zhenxing | sys | root | 127.0.0.1:25374 | oceanbase | 0 | 1 | MCS_ACTIVE_READER | 3767 | 3754 |
| 92 | 55 | zhenxing | zhenxing | root | 10.186.61.159:64190 | NULL | 0 | 1 | MCS_ACTIVE_READER | 3754 | 3754 |
+--------------+---------+----------+----------+------+---------------------+-----------+-------------+-------------------+-------------------+------+------+
2 rows in set (0.066 sec)
## 查看当前的连接, 后端OBserver的连接
root@127.0.0.1[oceanbase]> show processlist;
+---------+----------+------+---------------------+-----------+-------------+-------------------+-------------------+------+------+
| Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
+---------+----------+------+---------------------+-----------+-------------+-------------------+-------------------+------+------+
| 1048601 | sys | root | 127.0.0.1:25374 | oceanbase | 0 | 1 | MCS_ACTIVE_READER | 3767 | 3754 |
| 55 | zhenxing | root | 10.186.61.159:64190 | NULL | 0 | 1 | MCS_ACTIVE_READER | 3754 | 3754 |
+---------+----------+------+---------------------+-----------+-------------+-------------------+-------------------+------+------+
2 rows in set (0.024 sec)
## 按照官方文档语法, 杀掉ID为55的连接触发报错,
root@127.0.0.1[oceanbase]> kill proxysession 55;
ERROR 1094 (HY000): Unknown thread id: 55
## 按照官方文档语法, 杀掉ID为1048601的连接,可正常执行(备注: 1048601就是本会话的连接ID)
root@127.0.0.1[oceanbase]> kill proxysession 1048601;
ERROR 1317 (70100): Query execution was interrupted
## 执行命令可以看到该连接已断开
root@127.0.0.1[oceanbase]> \s
ERROR 2013 (HY000): Lost connection to MySQL server during query