This topic describes how to query the detailed internal status of a specified client session on ODP.
Procedure
You can use the SHOW PROXYSESSION ATTRIBUTE statement in the sys tenant or a user tenant to query the detailed internal status of a specified client session on ODP, including the server session involved in the client session.
Connect to OceanBase AI Database by using ODP.
Here is an example:
obclient -h10.xx.xx.xx -uusername@obtenant#obdemo -P2883 -p****** -c -A oceanbaseFor more information about how to connect to OceanBase AI Database by using ODP, see Connect to OceanBase AI Database by using OBClient.
Query the detailed internal status of the specified client session.
The SQL syntax is as follows:
SHOW PROXYSESSION ATTRIBUTE [id [LIKE 'xxx']]The parameters are described as follows:
If
idis not specified, the details of the current session are returned. This query method is supported for ODP V1.1.0 and later. You can also query the value of a specified attribute of the current session in fuzzy match mode. This query method is supported for ODP V1.1.2 and later.If
idis specified, you can query the value of a specified attribute of a specified session in fuzzy match mode. This query method is supported for ODP V1.1.0 and later.In the statement,
idcan be replaced withcs_idorconnection_id. These parameters are equivalent.cs_idindicates the ID of a client session in ODP.connection_idindicates the ID of a client session in OceanBase AI Database.You can obtain
connection_idby executing theSELECT CONNECTION_ID();statement.The
LIKEoption supports fuzzy matches. Percent signs (%) and underscores (_) are supported.
Here are some examples:
View the detailed status of a client session.
SHOW PROXYSESSION ATTRIBUTE;The query result is as follows:
+----------------------------------+----------------------+----------------+ | attribute_name | value | info | +----------------------------------+----------------------+----------------+ | proxy_sessid | -6044239443189891054 | cs common | | cs_id | 65160 | cs common | | cluster | test420 | cs common | | tenant | mysql001 | cs common | | user | root | cs common | | host_ip | 100.xx.xx.xx | cs common | | host_port | 48056 | cs common | | db | NULL | cs common | | total_trans_cnt | 0 | cs common | | svr_session_cnt | 1 | cs common | | active | true | cs common | | read_state | MCS_ACTIVE_READER | cs common | | tid | 76286 | cs common | | pid | 76286 | cs common | | idc_name | | cs common | | modified_time | 0 | cs stat | | reported_time | 0 | cs stat | | hot_sys_var_version | 0 | cs var version | | sys_var_version | 2 | cs var version | | user_var_version | 0 | cs var version | | last_insert_id_version | 0 | cs var version | | db_name_version | 0 | cs var version | | server_ip | 172.xx.xx.xx | last used ss | | server_port | 2881 | last used ss | | server_sessid | 3221597019 | last used ss | | ss_id | 22 | last used ss | | state | MSS_KA_CLIENT_SLAVE | last used ss | | transact_count | 4 | last used ss | | server_trans_stat | 0 | last used ss | | hot_sys_var_version | 0 | last used ss | | sys_var_version | 2 | last used ss | | user_var_version | 0 | last used ss | | last_insert_id_version | 0 | last used ss | | db_name_version | 0 | last used ss | | is_checksum_supported | 1 | last used ss | | is_safe_read_weak_supported | 0 | last used ss | | is_checksum_switch_supported | 1 | last used ss | | checksum_switch | 1 | last used ss | | enable_extra_ok_packet_for_stats | 1 | last used ss | +----------------------------------+----------------------+----------------+ 39 rows in setPerform a fuzzy search to query detailed information about a specified attribute.
SHOW PROXYSESSION ATTRIBUTE 65160 like '%id%';The query result is as follows:
+------------------------+----------------------+----------------+ | attribute_name | value | info | +------------------------+----------------------+----------------+ | proxy_sessid | -6044239443189891054 | cs common | | cs_id | 65160 | cs common | | tid | 76286 | cs common | | pid | 76286 | cs common | | idc_name | | cs common | | last_insert_id_version | 0 | cs var version | | server_sessid | 3221597019 | last used ss | | ss_id | 22 | last used ss | | last_insert_id_version | 0 | last used ss | +------------------------+----------------------+----------------+ 9 rows in set
The meaning of each field is described in the following table:
FieldDescriptionattribute_name The name of the attribute. value The value of the attribute. info Basic information. Common attributes and their descriptions are listed in the following table:
FieldDescriptionproxy_sessid The session ID of ODP. cs_id The ID used by ODP to internally identify each client. cluster The name of the cluster to which the client session belongs. tenant The tenant. user The user. host_ip The IP address of the user. host_port The port number of the user. db The database. total_trans_cnt The total number of transmitted transactions. svr_session_cnt The total number of sessions. active Indicates whether the session is alive. read_state The status of the client session. tid The thread ID. pid The process ID. modified_time The time of the last modification. reported_time The time of the last report. hot_sys_var_version The version of the system variable subject to hot updates. sys_var_version The version of the system variable. user_var_version The version of the user variable. last_insert_id_version The version of the last inserted ID. db_name_version The version of the database name. server_ip The IP address of the OBServer node. server_port The port number of the OBServer node. server_sessid The session ID of the OBServer node. ss_id The ID used by ODP to identify the server session. state The network connection status. transact_count The number of transactions executed by the current server session. server_trans_stat The execution status of the current server session, mainly used to verify the accuracy of the request execution of the current server session. hot_sys_var_version The versions of common system variables stored by ODP. sys_var_version The version of the system variable stored by ODP. user_var_version The version of the user system variable stored by ODP. last_insert_id_version The version of the last_insert_idvariable stored by ODP.db_name_version The version of the current database variable stored by ODP. is_checksum_supported Whether checksum is enabled for the current server session. is_safe_read_weak_supported Whether safe weak read is supported. is_checksum_switch_supported Whether the checksum switch supports real-time enabling or disabling. checksum_switch The status of the checksum switch. enable_extra_ok_packet_for_stats Whether additional return status acknowledgment packets are supported.