ss proxy 5.0 版本,疑SCHEMA_PRIVILEGES_PERMITTED 模式下的数据库源绑定bug

配置

#server.yaml 
rules:
  - !AUTHORITY
    users:
      - root@%:root
      - sharding@:sharding
    provider:
      type: SCHEMA_PRIVILEGES_PERMITTED
      props:
        user-schema-mappings: root@=test_encrypt_db   #数据源未配置test_encrypt_db,mysql中也不存在该db
#config-encrypt.yaml

schemaName: encrypt_db  #数据源定义
dataSources:
  ds_0:
    url: jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC&useSSL=false
    username: test
    password: test

问题点:在config-encrypt.yaml中定义了数据源“encrypt_db”,使用root:root帐号在proxy中看到了 test_encrypt_db 数据源,按正常逻辑,是无法看到任何数据源的。


mysql> show databases;
+-----------------+
| schema_name     |
+-----------------+
| test_encrypt_db |
+-----------------+

mysql> use test_encrypt_db
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 SCHEMA RESOURCES ;
+------+-------+-----------+------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name | type  | host      | port | db   | attribute                                                                                                                                                   |
+------+-------+-----------+------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ds_0 | MySQL | 127.0.0.1 | 3306 | test | {"maxLifetimeMilliseconds":1800000,"readOnly":false,"minPoolSize":1,"idleTimeoutMilliseconds":60000,"maxPoolSize":50,"connectionTimeoutMilliseconds":30000} |
+------+-------+-----------+------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.05 sec)

上述配置下,使用sharding:sharding 用户登录proxy后,无法看到任何数据库,这个是正常的。

1、是否是之前创建过 test_encrypt_db,且添加了数据源 ds_0?
2、是否是 Cluster 模式,使用了注册中心? 若是,请看下 overwrite 配置项是否为 true。

有这个问题,我处理下。

京ICP备2021015875号