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 2020/03/31 07:13:35 UTC

[GitHub] [incubator-shardingsphere] cherrylzhao opened a new pull request #5016: refactor DatabaseMetaData for sharding-jdbc

cherrylzhao opened a new pull request #5016: refactor DatabaseMetaData for sharding-jdbc
URL: https://github.com/apache/incubator-shardingsphere/pull/5016
 
 
   in sharding-jdbc getMetaData is like this:
   ```java
       @Override
       public DatabaseMetaData getMetaData() throws SQLException {
           return getCachedConnections().isEmpty() ? runtimeContext.getCachedDatabaseMetaData() : getCachedConnections().values().iterator().next().getMetaData();
       }
   ```
   two problems exists:
   
   - if `getCachedConnections().isEmpty()`, databaseMetaData will get from a physical connection, however physical connection's metadata will not return a logic tableName which we have converted in CachedDatabaseMetaData by ShardingRule currently.
   
   - getCachedConnections().isNotEmpty, databaseMetaData will get from CachedDatabaseMetaData which get connection every time for ResultSet returned interface
   
   I have extract a MultipleDatabaseMetaData abstract class which includes cacchedConnection, subclass is ShardingDatabaseMetaData and MasterSlaveDatabaseMetaData. CachedDatabaseMetaData will only contains cached properties only, initialized when DataSource was created. In this way below 2 problems will be resolved, meantime the performance will not reduce.
   
   

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu merged pull request #5016: refactor DatabaseMetaData for sharding-jdbc

Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #5016: refactor DatabaseMetaData for sharding-jdbc
URL: https://github.com/apache/incubator-shardingsphere/pull/5016
 
 
   

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


With regards,
Apache Git Services