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 04:02:02 UTC

[GitHub] [shardingsphere] justbk2015 opened a new issue #12672: can't connect proxy when proxy restart after scaling task end

justbk2015 opened a new issue #12672:
URL: https://github.com/apache/shardingsphere/issues/12672


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   master
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   proxy
   ### Expected behavior
   when scaling task over and I restart proxy, I can use gsql connect to opengauss.
   ### Actual behavior
   I can use gsql connect to opengauss, the return info is:
   gsql: received invalid response to SSL negotiation: j.
   ### Reason analyze (If you can)
   1. the reason is  FrontDatabaseProtocolTypeFactory::getDatabaseType function use invalid schema to set databaseType to default. (default is MySQL),.
   2.because when scaling task running,  it add logic_db on governance_ds/metadata/, but this schema dataSources is empty.
   getDatabaseType only use first schema (this is logic) , and  that databaseType is MySQL, so error occur.
   3. I guess use postgrsql database have some problem.
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   1. open sharding-proxy zookeeper config and scaling config, then start
   2. start sharding-scaling
   3. create a scaling job (no need wait this job over, just when zookeeper have logic_db node in governance_ds/metadata/)
   4.  delete job from zookeeker
   5. restart sharding-proxy
   6. use gsql connect to openguass, judje if can connect success.
   ### Example codes for reproduce this issue (such as a github link).
   no need.


-- 
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



[GitHub] [shardingsphere] sandynz commented on issue #12672: can't connect proxy when proxy restart after scaling task end

Posted by GitBox <gi...@apache.org>.
sandynz commented 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()`, start proxy, `ProxyContext.getInstance().getContextManager().getMetaDataContexts().getAllSchemaNames()` return `0 = "logic_db"
   1 = "sharding_db"
   2 = "shard1"`.
   
   `.iterator().next()` will return `logic_db`. Since `dataSources` is empty, then default database 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



[GitHub] [shardingsphere] sandynz edited a comment on issue #12672: can't connect proxy when proxy restart after scaling task end

Posted by GitBox <gi...@apache.org>.
sandynz edited a comment on issue #12672:
URL: https://github.com/apache/shardingsphere/issues/12672#issuecomment-926334706


   It seems proxy get a schema (e.g. logic_db) which configuration is not complete (`dataSources` and `rules` are empty), so it cause issue.
   
   I'll reproduce it and comment here later.
   


-- 
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



[GitHub] [shardingsphere] sandynz commented on issue #12672: can't connect proxy when proxy restart after scaling task end

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #12672:
URL: https://github.com/apache/shardingsphere/issues/12672#issuecomment-926334706


   It works on OSX which scaling.
   
   It seems proxy get a schema (e.g. logic_db) which configuration is not complete (`dataSources` and `rules` are empty) on Windows platform, so it cause issue.
   
   I'll reproduce it and comment here later.
   


-- 
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



[GitHub] [shardingsphere] sandynz edited a comment on issue #12672: can't connect proxy when proxy restart after scaling task end

Posted by GitBox <gi...@apache.org>.
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"`.
   
   `.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



[GitHub] [shardingsphere] terrymanu closed issue #12672: Proxy might get wrong schema which configuration is not complete to decide frontend database protocol type

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #12672:
URL: https://github.com/apache/shardingsphere/issues/12672


   


-- 
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



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

Posted by GitBox <gi...@apache.org>.
justbk2015 commented on issue #12672:
URL: https://github.com/apache/shardingsphere/issues/12672#issuecomment-927299700


   @rfscholte you only modify first problem, 
    BootstrapInitializer.java have some problem (can't initlization) --this problem still exists, I think, you need some filter operator to avoid empty logic_db.


-- 
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



[GitHub] [shardingsphere] sandynz edited a comment on issue #12672: can't connect proxy when proxy restart after scaling task end

Posted by GitBox <gi...@apache.org>.
sandynz edited a comment on issue #12672:
URL: https://github.com/apache/shardingsphere/issues/12672#issuecomment-926334706


   It works on OSX with scaling.
   
   It seems proxy get a schema (e.g. logic_db) which configuration is not complete (`dataSources` and `rules` are empty) on Windows platform, so it cause issue.
   
   I'll reproduce it and comment here later.
   


-- 
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



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

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #12672:
URL: https://github.com/apache/shardingsphere/issues/12672#issuecomment-927306882


   > @rfscholte you only modify first problem,
   > BootstrapInitializer.java have some problem (can't initlization) --this problem still exists, I think, you need some filter operator to avoid empty logic_db.
   
   I tested with `psql`, it works, but `setDatabaseServerInfo()` will ignore `setServerVersion`, since `findBackendDataSource()` return empty result.
   
   I'll start another PR to improve it.
   


-- 
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



[GitHub] [shardingsphere] sandynz edited a comment on issue #12672: can't connect proxy when proxy restart after scaling task end

Posted by GitBox <gi...@apache.org>.
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"`.
   
   `.iterator().next()` will return `logic_db`. Since `dataSources` is empty, then default database 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



[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

Posted by GitBox <gi...@apache.org>.
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