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 2022/06/21 12:25:15 UTC

[GitHub] [shardingsphere] linghengqian opened a new issue, #18494: Confusion about changes to ShardingSphereDataSource and ContextManager

linghengqian opened a new issue, #18494:
URL: https://github.com/apache/shardingsphere/issues/18494

   ## Question
   
   **For English only**, other languages will not accept.
   
   Before asking a question, make sure you have:
   
   - Googled your question.
   - 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**.
   
   - I'm confused about some changes to `ShardingSphereDataSource` and `ContextManager` in `ShardingSphere 5.1.2`. In https://github.com/apache/shardingsphere/pull/17860 , removed `org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource` 's get method of the properties makes it impossible to get `org.apache.shardingsphere.mode.manager.ContextManager` directly through `ShardingSphereDataSource#getContextManager`, but must be obtained through the following method reflection.
   
   ```java
   @SneakyThrows(ReflectiveOperationException.class)
   public static ContextManager getContextManager(final ShardingSphereDataSource dataSource) {
       Field field = ShardingSphereDataSource.class.getDeclaredField("contextManager");
       field.setAccessible(true);
       return (ContextManager) field.get(dataSource);
   }
   ```
   
   - What's the point of this change? I'd be grateful if someone could help answer this question.
   
   - For `org.apache.shardingsphere.mode.manager.ContextManager`, its changes are not reflected much in the Realease Note. 
       - In https://github.com/apache/shardingsphere/pull/16919, `getMetaData(final String schemaName)` was changed to `getMetaData(final String databaseName)`, the signature changed. 
       - Then in https://github.com/apache/shardingsphere/pull/17792 , the function signature was changed from `public ShardingSphereMetaData getMetaData(final String databaseName) )` is changed to `public ShardingSphereDatabaseMetaData getDatabaseMetaData(final String databaseName)`, and the method name is changed. 
       - In https://github.com/apache/shardingsphere/pull/17817 , `public ShardingSphereDatabaseMetaData getDatabaseMetaData(final String databaseName)` becomes `public ShardingSphereDatabase getDatabaseMetaData(final String databaseName)`, the return body changes. 
       - In https://github.com/apache/shardingsphere/pull/17958 , `public ShardingSphereDatabase getDatabaseMetaData(final String databaseName)` becomes `public ShardingSphereDatabase getDatabase (final String databaseName)`, the method name changed again. 
       - I noticed that this parameterized constructor `getDatabase(final String databaseName)` ended up in https://github.com/apache/shardingsphere/pull/17983 has been removed. 
   
   - This finally changes in ShardingSphere 5.1.2, getting `Collection<org.apache.shardingsphere.infra.config.RuleConfiguration>` which is hard to see in the Release Note. From
   ```java
   Collection<RuleConfiguration> testRuleConfigList = shardingSphereDataSource.getContextManager()
           .getMetaDataContexts()
           .getMetaData(schemaName)
           .getRuleMetaData()
           .getConfigurations();
   ```
   - to (Now `getContextManager()` needs to be obtained by reflection of custom function.)
   
   ```java
   Collection<RuleConfiguration> testRuleConfigList = getContextManager(shardingSphereDataSource)
                   .getMetaDataContexts()
                   .getMetaData()
                   .getDatabases()
                   .get(databaseName)
                   .getRuleMetaData()
                   .getConfigurations();
   ```
     
   - Given that the changes to `ContextManager` are so complex, is it possible to add a description of the API changes somewhere in the public article or documentation?
   


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

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


[GitHub] [shardingsphere] linghengqian closed issue #18494: Confusion about changes to ShardingSphereDataSource and ContextManager

Posted by GitBox <gi...@apache.org>.
linghengqian closed issue #18494: Confusion about changes to ShardingSphereDataSource and ContextManager
URL: https://github.com/apache/shardingsphere/issues/18494


-- 
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 commented on issue #18494: Confusion about changes to ShardingSphereDataSource and ContextManager

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

   Metadata module is still being adjusted.


-- 
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] linghengqian commented on issue #18494: Confusion about changes to ShardingSphereDataSource and ContextManager

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

   Wow, I'm looking forward to what the metadata module will look like in the end.


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