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/07/21 09:31:44 UTC

[GitHub] [shardingsphere] zjcnb opened a new issue, #19432: databases in TransactionRule does not perceive change when i create database xx

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

   ### Which version of ShardingSphere did you use?
   
   master
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   Perceived change
   
   ### Actual behavior
   
   Not perceived
   
   ### Reason analyze (If you can)
   
   ```
    public static MetaDataContexts create(final MetaDataPersistService persistService, final Map<String, DatabaseConfiguration> databaseConfigs,
                                             final InstanceContext instanceContext) throws SQLException {
           Collection<String> databaseNames = instanceContext.getInstance().getMetaData() instanceof JDBCInstanceMetaData
                   ? databaseConfigs.keySet()
                   : persistService.getDatabaseMetaDataService().loadAllDatabaseNames();
           Map<String, DatabaseConfiguration> effectiveDatabaseConfigs = createEffectiveDatabaseConfigurations(databaseNames, databaseConfigs, persistService);
           Collection<RuleConfiguration> globalRuleConfigs = persistService.getGlobalRuleService().load();
           ConfigurationProperties props = new ConfigurationProperties(persistService.getPropsService().load());
           Map<String, ShardingSphereDatabase> databases = ShardingSphereDatabasesFactory.create(effectiveDatabaseConfigs, props, instanceContext);
           ShardingSphereRuleMetaData globalMetaData = new ShardingSphereRuleMetaData(GlobalRulesBuilder.buildRules(globalRuleConfigs, databases, instanceContext));
           return new MetaDataContexts(persistService, new ShardingSphereMetaData(databases, globalMetaData, props), OptimizerContextFactory.create(databases, globalMetaData));
       }
   ```
   
   The database is reassigned, such as :
   
   ```
       public ShardingSphereMetaData(final Map<String, ShardingSphereDatabase> databases, final ShardingSphereRuleMetaData globalRuleMetaData, final ConfigurationProperties props) {
           this.databases = new ConcurrentHashMap<>(databases.size(), 1);
           databases.forEach((key, value) -> this.databases.put(key.toLowerCase(), value));
           this.globalRuleMetaData = globalRuleMetaData;
           this.props = props;
       }
   ```
   
   
   
   


-- 
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] strongduanmu closed issue #19432: The databases in TransactionRule does not perceive change when i create database xx

Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #19432: The databases in TransactionRule does not perceive change when i create database xx
URL: https://github.com/apache/shardingsphere/issues/19432


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