You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/09/24 10:00:19 UTC

[GitHub] [shardingsphere] sandynz edited a comment on issue #12672: Proxy might get wrong schema which configuration is not complete to decide frontend database protocol type

sandynz edited a comment on issue #12672:
URL: https://github.com/apache/shardingsphere/issues/12672#issuecomment-926480024


   Verification:
   ```
   mysql> create database logic_db;
   Query OK, 0 rows affected (0.01 sec)
   
   mysql> show databases;
   +-------------+
   | schema_name |
   +-------------+
   | sharding_db |
   | shard1      |
   | logic_db    |
   +-------------+
   3 rows in set (0.00 sec)
   ```
   
   `logic_db` has empty `dataSources` and `rules`.
   
   Set breakpoint on `FrontDatabaseProtocolTypeFactory.getDatabaseType()`, restart proxy, `ProxyContext.getInstance().getContextManager().getMetaDataContexts().getAllSchemaNames()` return `0 = "logic_db"
   1 = "sharding_db"
   2 = "shard1"`.
   
   `ProxyContext.getInstance().getContextManager().getMetaDataContexts().getAllSchemaNames().iterator().next()` will return `"logic_db"`. Since `dataSources` is empty, then default database MySQL (`DatabaseTypeRegistry.DEFAULT_DATABASE_TYPE = "MySQL"`) will be used.
   If current testing database type is not MySQL, then connect to proxy will be failed.
   
   Since `getAllSchemaNames()` return `HashMap`, the first element depends on contents.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org