matrixorigin / matrixone

Hyperconverged cloud-edge native database
https://docs.matrixorigin.cn/en
Apache License 2.0
1.79k stars 277 forks source link

[Bug]: show columns from mo_sessions Result error #15740

Closed qingxinhome closed 6 months ago

qingxinhome commented 6 months ago

Is there an existing issue for the same bug?

Branch Name

1.1-dev main

Commit ID

a39f4af08

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

登录进一个普通租户: mysql> use mo_catalog; Database changed mysql> show columns from mo_sessions; +-----------------+-----------------+------+------+---------+-------+---------+ | Field | Type | Null | Key | Default | Extra | Comment | +-----------------+-----------------+------+------+---------+-------+---------+ | node_id | VARCHAR(65535) | YES | | NULL | | | | node_id | VARCHAR(65535) | YES | | NULL | | | | conn_id | INT UNSIGNED(0) | YES | | NULL | | | | conn_id | INT UNSIGNED(0) | YES | | NULL | | | | session_id | VARCHAR(65535) | YES | | NULL | | | | session_id | VARCHAR(65535) | YES | | NULL | | | | account | VARCHAR(65535) | YES | | NULL | | | | account | VARCHAR(65535) | YES | | NULL | | | | user | VARCHAR(65535) | YES | | NULL | | | | user | VARCHAR(65535) | YES | | NULL | | | | host | VARCHAR(65535) | YES | | NULL | | | | host | VARCHAR(65535) | YES | | NULL | | | | db | VARCHAR(65535) | YES | | NULL | | | | db | VARCHAR(65535) | YES | | NULL | | | | session_start | VARCHAR(65535) | YES | | NULL | | | | session_start | VARCHAR(65535) | YES | | NULL | | | | command | VARCHAR(65535) | YES | | NULL | | | | command | VARCHAR(65535) | YES | | NULL | | | | info | VARCHAR(65535) | YES | | NULL | | | | info | VARCHAR(65535) | YES | | NULL | | | | txn_id | VARCHAR(65535) | YES | | NULL | | | | txn_id | VARCHAR(65535) | YES | | NULL | | | | statement_id | VARCHAR(65535) | YES | | NULL | | | | statement_id | VARCHAR(65535) | YES | | NULL | | | | statement_type | VARCHAR(65535) | YES | | NULL | | | | statement_type | VARCHAR(65535) | YES | | NULL | | | | query_type | VARCHAR(65535) | YES | | NULL | | | | query_type | VARCHAR(65535) | YES | | NULL | | | | sql_source_type | VARCHAR(65535) | YES | | NULL | | | | sql_source_type | VARCHAR(65535) | YES | | NULL | | | | query_start | VARCHAR(65535) | YES | | NULL | | | | query_start | VARCHAR(65535) | YES | | NULL | | | | client_host | VARCHAR(65535) | YES | | NULL | | | | client_host | VARCHAR(65535) | YES | | NULL | | | | role | VARCHAR(65535) | YES | | NULL | | | | role | VARCHAR(65535) | YES | | NULL | | | | proxy_host | VARCHAR(65535) | YES | | NULL | | | | proxy_host | VARCHAR(65535) | YES | | NULL | | | +-----------------+-----------------+------+------+---------+-------+---------+

mysql> show columns from mo_configurations; +---------------+----------------+------+------+---------+-------+---------+ | Field | Type | Null | Key | Default | Extra | Comment | +---------------+----------------+------+------+---------+-------+---------+ | node_type | VARCHAR(65535) | YES | | NULL | | | | node_type | VARCHAR(65535) | YES | | NULL | | | | node_id | VARCHAR(65535) | YES | | NULL | | | | node_id | VARCHAR(65535) | YES | | NULL | | | | name | VARCHAR(65535) | YES | | NULL | | | | name | VARCHAR(65535) | YES | | NULL | | | | current_value | VARCHAR(65535) | YES | | NULL | | | | current_value | VARCHAR(65535) | YES | | NULL | | | | default_value | VARCHAR(65535) | YES | | NULL | | | | default_value | VARCHAR(65535) | YES | | NULL | | | | internal | VARCHAR(65535) | YES | | NULL | | | | internal | VARCHAR(65535) | YES | | NULL | | | +---------------+----------------+------+------+---------+-------+---------+ 12 rows in set (0.40 sec)

结果错误: 系统视图的列名重复, 原因是租户隔离不彻底

Expected Behavior

登录进一个普通租户: mysql> use mo_catalog; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

Database changed mysql> show columns from mo_sessions; +-----------------+-----------------+------+------+---------+-------+---------+ | Field | Type | Null | Key | Default | Extra | Comment | +-----------------+-----------------+------+------+---------+-------+---------+ | node_id | VARCHAR(65535) | YES | | NULL | | | | conn_id | INT UNSIGNED(0) | YES | | NULL | | | | session_id | VARCHAR(65535) | YES | | NULL | | | | account | VARCHAR(65535) | YES | | NULL | | | | user | VARCHAR(65535) | YES | | NULL | | | | host | VARCHAR(65535) | YES | | NULL | | | | db | VARCHAR(65535) | YES | | NULL | | | | session_start | VARCHAR(65535) | YES | | NULL | | | | command | VARCHAR(65535) | YES | | NULL | | | | info | VARCHAR(65535) | YES | | NULL | | | | txn_id | VARCHAR(65535) | YES | | NULL | | | | statement_id | VARCHAR(65535) | YES | | NULL | | | | statement_type | VARCHAR(65535) | YES | | NULL | | | | query_type | VARCHAR(65535) | YES | | NULL | | | | sql_source_type | VARCHAR(65535) | YES | | NULL | | | | query_start | VARCHAR(65535) | YES | | NULL | | | | client_host | VARCHAR(65535) | YES | | NULL | | | | role | VARCHAR(65535) | YES | | NULL | | | +-----------------+-----------------+------+------+---------+-------+---------+ 18 rows in set (0.75 sec)

mysql> show columns from mo_configurations; +---------------+----------------+------+------+---------+-------+---------+ | Field | Type | Null | Key | Default | Extra | Comment | +---------------+----------------+------+------+---------+-------+---------+ | node_type | VARCHAR(65535) | YES | | NULL | | | | node_id | VARCHAR(65535) | YES | | NULL | | | | name | VARCHAR(65535) | YES | | NULL | | | | current_value | VARCHAR(65535) | YES | | NULL | | | | default_value | VARCHAR(65535) | YES | | NULL | | | | internal | VARCHAR(65535) | YES | | NULL | | | +---------------+----------------+------+------+---------+-------+---------+ 6 rows in set (0.72 sec)

Steps to Reproduce

Log in as a non system tenant and execute SQL

Additional information

The following system views under the catalog also have this issue: mo_sessions , mo_configurations , mo_locks, mo_variables, mo_transactions, mo_cache No response

qingxinhome commented 6 months ago

pr已提交

qingxinhome commented 6 months ago

The issue has been resolved and PR has been merged. Please verify and test @sukki37 @heni02 @daviszhen

heni02 commented 6 months ago

confirm,closed main commit:341c2b6e358d776186e20a723bf96849e409ccff heni@henideMacBook-Pro matrixone % mysql -h 127.0.0.1 -uabc:admin -P6001 -p123456 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1398 Server version: 8.0.30-MatrixOne-v341263 MatrixOne

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mo_catalog; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

Database changed mysql> show columns from mo_sessions; +-----------------+-----------------+------+------+---------+-------+---------+ | Field | Type | Null | Key | Default | Extra | Comment | +-----------------+-----------------+------+------+---------+-------+---------+ | node_id | VARCHAR(65535) | YES | | NULL | | | | conn_id | INT UNSIGNED(0) | YES | | NULL | | | | session_id | VARCHAR(65535) | YES | | NULL | | | | account | VARCHAR(65535) | YES | | NULL | | | | user | VARCHAR(65535) | YES | | NULL | | | | host | VARCHAR(65535) | YES | | NULL | | | | db | VARCHAR(65535) | YES | | NULL | | | | session_start | VARCHAR(65535) | YES | | NULL | | | | command | VARCHAR(65535) | YES | | NULL | | | | info | VARCHAR(65535) | YES | | NULL | | | | txn_id | VARCHAR(65535) | YES | | NULL | | | | statement_id | VARCHAR(65535) | YES | | NULL | | | | statement_type | VARCHAR(65535) | YES | | NULL | | | | query_type | VARCHAR(65535) | YES | | NULL | | | | sql_source_type | VARCHAR(65535) | YES | | NULL | | | | query_start | VARCHAR(65535) | YES | | NULL | | | | client_host | VARCHAR(65535) | YES | | NULL | | | | role | VARCHAR(65535) | YES | | NULL | | | | proxy_host | VARCHAR(65535) | YES | | NULL | | | +-----------------+-----------------+------+------+---------+-------+---------+ 19 rows in set (0.01 sec)