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/01/07 05:59:28 UTC

[GitHub] [shardingsphere] tigerxn opened a new pull request #8928: 8927

tigerxn opened a new pull request #8928:
URL: https://github.com/apache/shardingsphere/pull/8928


   Fixes 8927.
   
   Changes proposed in this pull request:
   -
   -
   -
   


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

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



[GitHub] [shardingsphere] tigerxn commented on a change in pull request #8928: 8927

Posted by GitBox <gi...@apache.org>.
tigerxn commented on a change in pull request #8928:
URL: https://github.com/apache/shardingsphere/pull/8928#discussion_r555017546



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
##########
@@ -115,7 +116,13 @@ public ShardingSphereMetaData getMetaData(final String schemaName) {
         if (schemaNames.isEmpty()) {
             return Optional.empty();
         }
-        Map<String, DataSource> dataSources = getMetaData(schemaNames.get(0)).getResource().getDataSources();
-        return dataSources.values().stream().findFirst();
+        for (String schemaName : schemaNames) {
+            ShardingSphereResource shardingSphereResource = getMetaData(schemaName).getResource();
+            DatabaseType databaseType = shardingSphereResource.getDatabaseType();
+            if ("MySQL".equals(databaseType.getName())) {
+                return shardingSphereResource.getDataSources().values().stream().findFirst();
+            }

Review comment:
       please revivew again.




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

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



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #8928: 8927

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #8928:
URL: https://github.com/apache/shardingsphere/pull/8928#discussion_r554704956



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
##########
@@ -115,7 +116,13 @@ public ShardingSphereMetaData getMetaData(final String schemaName) {
         if (schemaNames.isEmpty()) {
             return Optional.empty();
         }
-        Map<String, DataSource> dataSources = getMetaData(schemaNames.get(0)).getResource().getDataSources();
-        return dataSources.values().stream().findFirst();
+        for (String schemaName : schemaNames) {
+            ShardingSphereResource shardingSphereResource = getMetaData(schemaName).getResource();
+            DatabaseType databaseType = shardingSphereResource.getDatabaseType();
+            if ("MySQL".equals(databaseType.getName())) {
+                return shardingSphereResource.getDataSources().values().stream().findFirst();
+            }

Review comment:
       The ProxyContext is public class which is in shardingsphere-proxy-backend module.
   The database dialect should in their own module, it is better to keep public modules independent, and let them do not know database dialect details.
   




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

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



[GitHub] [shardingsphere] tigerxn commented on a change in pull request #8928: 8927

Posted by GitBox <gi...@apache.org>.
tigerxn commented on a change in pull request #8928:
URL: https://github.com/apache/shardingsphere/pull/8928#discussion_r554011620



##########
File path: shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/AbstractBootstrapInitializer.java
##########
@@ -113,6 +113,8 @@ private void setDatabaseServerInfo() {
             DatabaseServerInfo databaseServerInfo = new DatabaseServerInfo(dataSourceSample.get());
             log.info(databaseServerInfo.toString());
             MySQLServerInfo.setServerVersion(databaseServerInfo.getDatabaseVersion());
+        } else {
+            MySQLServerInfo.setServerVersion(null);

Review comment:
       OK

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
##########
@@ -115,7 +116,13 @@ public ShardingSphereMetaData getMetaData(final String schemaName) {
         if (schemaNames.isEmpty()) {
             return Optional.empty();
         }
-        Map<String, DataSource> dataSources = getMetaData(schemaNames.get(0)).getResource().getDataSources();
-        return dataSources.values().stream().findFirst();
+        for (String schemaName : schemaNames) {
+            ShardingSphereResource shardingSphereResource = getMetaData(schemaName).getResource();
+            DatabaseType databaseType = shardingSphereResource.getDatabaseType();
+            if ("MySQL".equals(databaseType.getName())) {
+                return shardingSphereResource.getDataSources().values().stream().findFirst();
+            }

Review comment:
       This method is only used by mysql, PostgreSQLdoes not set the version information.




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

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



[GitHub] [shardingsphere] terrymanu merged pull request #8928: 8927

Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #8928:
URL: https://github.com/apache/shardingsphere/pull/8928


   


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

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



[GitHub] [shardingsphere] tigerxn commented on a change in pull request #8928: 8927

Posted by GitBox <gi...@apache.org>.
tigerxn commented on a change in pull request #8928:
URL: https://github.com/apache/shardingsphere/pull/8928#discussion_r554015311



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
##########
@@ -115,7 +116,13 @@ public ShardingSphereMetaData getMetaData(final String schemaName) {
         if (schemaNames.isEmpty()) {
             return Optional.empty();
         }
-        Map<String, DataSource> dataSources = getMetaData(schemaNames.get(0)).getResource().getDataSources();
-        return dataSources.values().stream().findFirst();
+        for (String schemaName : schemaNames) {
+            ShardingSphereResource shardingSphereResource = getMetaData(schemaName).getResource();
+            DatabaseType databaseType = shardingSphereResource.getDatabaseType();
+            if ("MySQL".equals(databaseType.getName())) {
+                return shardingSphereResource.getDataSources().values().stream().findFirst();
+            }

Review comment:
       The method(getDataSourceSample) name can be changed。




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

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



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #8928: 8927

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #8928:
URL: https://github.com/apache/shardingsphere/pull/8928#discussion_r553876453



##########
File path: shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/AbstractBootstrapInitializer.java
##########
@@ -113,6 +113,8 @@ private void setDatabaseServerInfo() {
             DatabaseServerInfo databaseServerInfo = new DatabaseServerInfo(dataSourceSample.get());
             log.info(databaseServerInfo.toString());
             MySQLServerInfo.setServerVersion(databaseServerInfo.getDatabaseVersion());
+        } else {
+            MySQLServerInfo.setServerVersion(null);

Review comment:
       set null maybe unnecessary

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
##########
@@ -115,7 +116,13 @@ public ShardingSphereMetaData getMetaData(final String schemaName) {
         if (schemaNames.isEmpty()) {
             return Optional.empty();
         }
-        Map<String, DataSource> dataSources = getMetaData(schemaNames.get(0)).getResource().getDataSources();
-        return dataSources.values().stream().findFirst();
+        for (String schemaName : schemaNames) {
+            ShardingSphereResource shardingSphereResource = getMetaData(schemaName).getResource();
+            DatabaseType databaseType = shardingSphereResource.getDatabaseType();
+            if ("MySQL".equals(databaseType.getName())) {
+                return shardingSphereResource.getDataSources().values().stream().findFirst();
+            }

Review comment:
       This is the public module, we cannot consider about MySQL only.
   What is the behaviour of PostgreSQL?




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

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



[GitHub] [shardingsphere] codecov-io commented on pull request #8928: 8927

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #8928:
URL: https://github.com/apache/shardingsphere/pull/8928#issuecomment-757957070


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8928?src=pr&el=h1) Report
   > Merging [#8928](https://codecov.io/gh/apache/shardingsphere/pull/8928?src=pr&el=desc) (85e8872) into [master](https://codecov.io/gh/apache/shardingsphere/commit/2e8d80e44a34be869572e7c50cac3b0c26af73f2?el=desc) (2e8d80e) will **decrease** coverage by `0.23%`.
   > The diff coverage is `21.05%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/8928/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/8928?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #8928      +/-   ##
   ============================================
   - Coverage     70.45%   70.22%   -0.24%     
   + Complexity      654      652       -2     
   ============================================
     Files          1638     1633       -5     
     Lines         26053    26217     +164     
     Branches       4515     4567      +52     
   ============================================
   + Hits          18355    18410      +55     
   - Misses         6476     6564      +88     
   - Partials       1222     1243      +21     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/8928?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...re/db/protocol/mysql/constant/MySQLServerInfo.java](https://codecov.io/gh/apache/shardingsphere/pull/8928/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wvc2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RiL3Byb3RvY29sL215c3FsL2NvbnN0YW50L015U1FMU2VydmVySW5mby5qYXZh) | `100.00% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...dingsphere/proxy/backend/context/ProxyContext.java](https://codecov.io/gh/apache/shardingsphere/pull/8928/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9jb250ZXh0L1Byb3h5Q29udGV4dC5qYXZh) | `100.00% <ø> (+10.00%)` | `0.00 <0.00> (ø)` | |
   | [...initializer/impl/AbstractBootstrapInitializer.java](https://codecov.io/gh/apache/shardingsphere/pull/8928/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYm9vdHN0cmFwL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9wcm94eS9pbml0aWFsaXplci9pbXBsL0Fic3RyYWN0Qm9vdHN0cmFwSW5pdGlhbGl6ZXIuamF2YQ==) | `43.63% <7.14%> (-5.35%)` | `0.00 <0.00> (ø)` | |
   | [.../driver/jdbc/metadata/JDBCQueryResultMetaData.java](https://codecov.io/gh/apache/shardingsphere/pull/8928/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtZXhlY3V0b3Ivc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL2V4ZWN1dG9yL3NxbC9leGVjdXRlL3Jlc3VsdC9xdWVyeS9pbXBsL2RyaXZlci9qZGJjL21ldGFkYXRhL0pEQkNRdWVyeVJlc3VsdE1ldGFEYXRhLmphdmE=) | `76.92% <33.33%> (-13.99%)` | `0.00 <0.00> (ø)` | |
   | [...ackend/text/TextProtocolBackendHandlerFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/8928/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L1RleHRQcm90b2NvbEJhY2tlbmRIYW5kbGVyRmFjdG9yeS5qYXZh) | `87.50% <100.00%> (+0.83%)` | `0.00 <0.00> (ø)` | |
   | [...jaeger/service/JaegerTracingPluginBootService.java](https://codecov.io/gh/apache/shardingsphere/pull/8928/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tdHJhY2luZy9zaGFyZGluZ3NwaGVyZS1hZ2VudC10cmFjaW5nLWphZWdlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvcGx1Z2luL3RyYWNpbmcvamFlZ2VyL3NlcnZpY2UvSmFlZ2VyVHJhY2luZ1BsdWdpbkJvb3RTZXJ2aWNlLmphdmE=) | `21.42% <0.00%> (-63.19%)` | `1.00% <0.00%> (ø%)` | |
   | [...ere/governance/core/config/ConfigCacheManager.java](https://codecov.io/gh/apache/shardingsphere/pull/8928/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9jb25maWcvQ29uZmlnQ2FjaGVNYW5hZ2VyLmphdmE=) | `33.33% <0.00%> (-48.49%)` | `1.00% <0.00%> (ø%)` | |
   | [...istry/listener/DataSourceStateChangedListener.java](https://codecov.io/gh/apache/shardingsphere/pull/8928/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9yZWdpc3RyeS9saXN0ZW5lci9EYXRhU291cmNlU3RhdGVDaGFuZ2VkTGlzdGVuZXIuamF2YQ==) | `57.14% <0.00%> (-22.86%)` | `0.00% <0.00%> (ø%)` | |
   | [...te/context/ShardingSQLRewriteContextDecorator.java](https://codecov.io/gh/apache/shardingsphere/pull/8928/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctcmV3cml0ZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcmV3cml0ZS9jb250ZXh0L1NoYXJkaW5nU1FMUmV3cml0ZUNvbnRleHREZWNvcmF0b3IuamF2YQ==) | `83.33% <0.00%> (-16.67%)` | `2.00% <0.00%> (ø%)` | |
   | [...e/governance/core/registry/RegistryCenterNode.java](https://codecov.io/gh/apache/shardingsphere/pull/8928/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9yZWdpc3RyeS9SZWdpc3RyeUNlbnRlck5vZGUuamF2YQ==) | `73.91% <0.00%> (-10.71%)` | `0.00% <0.00%> (ø%)` | |
   | ... and [79 more](https://codecov.io/gh/apache/shardingsphere/pull/8928/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8928?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8928?src=pr&el=footer). Last update [2e8d80e...85e8872](https://codecov.io/gh/apache/shardingsphere/pull/8928?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


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

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



[GitHub] [shardingsphere] tigerxn commented on a change in pull request #8928: 8927

Posted by GitBox <gi...@apache.org>.
tigerxn commented on a change in pull request #8928:
URL: https://github.com/apache/shardingsphere/pull/8928#discussion_r554765433



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
##########
@@ -115,7 +116,13 @@ public ShardingSphereMetaData getMetaData(final String schemaName) {
         if (schemaNames.isEmpty()) {
             return Optional.empty();
         }
-        Map<String, DataSource> dataSources = getMetaData(schemaNames.get(0)).getResource().getDataSources();
-        return dataSources.values().stream().findFirst();
+        for (String schemaName : schemaNames) {
+            ShardingSphereResource shardingSphereResource = getMetaData(schemaName).getResource();
+            DatabaseType databaseType = shardingSphereResource.getDatabaseType();
+            if ("MySQL".equals(databaseType.getName())) {
+                return shardingSphereResource.getDataSources().values().stream().findFirst();
+            }

Review comment:
       This method(getDataSourceSample) is moved from ProxyContext  to AbstractBootstrapInitializer ,and changed to private
   method,only used by setDatabaseServerInfo。
   




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

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



[GitHub] [shardingsphere] tigerxn commented on a change in pull request #8928: 8927

Posted by GitBox <gi...@apache.org>.
tigerxn commented on a change in pull request #8928:
URL: https://github.com/apache/shardingsphere/pull/8928#discussion_r554011620



##########
File path: shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/AbstractBootstrapInitializer.java
##########
@@ -113,6 +113,8 @@ private void setDatabaseServerInfo() {
             DatabaseServerInfo databaseServerInfo = new DatabaseServerInfo(dataSourceSample.get());
             log.info(databaseServerInfo.toString());
             MySQLServerInfo.setServerVersion(databaseServerInfo.getDatabaseVersion());
+        } else {
+            MySQLServerInfo.setServerVersion(null);

Review comment:
       OK

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
##########
@@ -115,7 +116,13 @@ public ShardingSphereMetaData getMetaData(final String schemaName) {
         if (schemaNames.isEmpty()) {
             return Optional.empty();
         }
-        Map<String, DataSource> dataSources = getMetaData(schemaNames.get(0)).getResource().getDataSources();
-        return dataSources.values().stream().findFirst();
+        for (String schemaName : schemaNames) {
+            ShardingSphereResource shardingSphereResource = getMetaData(schemaName).getResource();
+            DatabaseType databaseType = shardingSphereResource.getDatabaseType();
+            if ("MySQL".equals(databaseType.getName())) {
+                return shardingSphereResource.getDataSources().values().stream().findFirst();
+            }

Review comment:
       This method is only used by mysql, PostgreSQLdoes not set the version information.

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
##########
@@ -115,7 +116,13 @@ public ShardingSphereMetaData getMetaData(final String schemaName) {
         if (schemaNames.isEmpty()) {
             return Optional.empty();
         }
-        Map<String, DataSource> dataSources = getMetaData(schemaNames.get(0)).getResource().getDataSources();
-        return dataSources.values().stream().findFirst();
+        for (String schemaName : schemaNames) {
+            ShardingSphereResource shardingSphereResource = getMetaData(schemaName).getResource();
+            DatabaseType databaseType = shardingSphereResource.getDatabaseType();
+            if ("MySQL".equals(databaseType.getName())) {
+                return shardingSphereResource.getDataSources().values().stream().findFirst();
+            }

Review comment:
       The method(getDataSourceSample) name can be changed。




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

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



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #8928: 8927

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #8928:
URL: https://github.com/apache/shardingsphere/pull/8928#discussion_r553876453



##########
File path: shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/AbstractBootstrapInitializer.java
##########
@@ -113,6 +113,8 @@ private void setDatabaseServerInfo() {
             DatabaseServerInfo databaseServerInfo = new DatabaseServerInfo(dataSourceSample.get());
             log.info(databaseServerInfo.toString());
             MySQLServerInfo.setServerVersion(databaseServerInfo.getDatabaseVersion());
+        } else {
+            MySQLServerInfo.setServerVersion(null);

Review comment:
       set null maybe unnecessary

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
##########
@@ -115,7 +116,13 @@ public ShardingSphereMetaData getMetaData(final String schemaName) {
         if (schemaNames.isEmpty()) {
             return Optional.empty();
         }
-        Map<String, DataSource> dataSources = getMetaData(schemaNames.get(0)).getResource().getDataSources();
-        return dataSources.values().stream().findFirst();
+        for (String schemaName : schemaNames) {
+            ShardingSphereResource shardingSphereResource = getMetaData(schemaName).getResource();
+            DatabaseType databaseType = shardingSphereResource.getDatabaseType();
+            if ("MySQL".equals(databaseType.getName())) {
+                return shardingSphereResource.getDataSources().values().stream().findFirst();
+            }

Review comment:
       This is the public module, we cannot consider about MySQL only.
   What is the behaviour of PostgreSQL?




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

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



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #8928: 8927

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #8928:
URL: https://github.com/apache/shardingsphere/pull/8928#discussion_r554704956



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
##########
@@ -115,7 +116,13 @@ public ShardingSphereMetaData getMetaData(final String schemaName) {
         if (schemaNames.isEmpty()) {
             return Optional.empty();
         }
-        Map<String, DataSource> dataSources = getMetaData(schemaNames.get(0)).getResource().getDataSources();
-        return dataSources.values().stream().findFirst();
+        for (String schemaName : schemaNames) {
+            ShardingSphereResource shardingSphereResource = getMetaData(schemaName).getResource();
+            DatabaseType databaseType = shardingSphereResource.getDatabaseType();
+            if ("MySQL".equals(databaseType.getName())) {
+                return shardingSphereResource.getDataSources().values().stream().findFirst();
+            }

Review comment:
       The ProxyContext is public class which is in shardingsphere-proxy-backend module.
   The database dialect should in their own module, it is better to keep public module independent, and let them do not know database dialect details.
   




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

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