You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "terrymanu (via GitHub)" <gi...@apache.org> on 2025/11/16 13:36:44 UTC

Re: [I] can't apply local datasource changing [shardingsphere]

terrymanu commented on issue #24117:
URL: https://github.com/apache/shardingsphere/issues/24117#issuecomment-3538763705

   After thorough analysis, this bug has actually been resolved through architectural refactoring in subsequent versions.
   
     Current Status: No Longer Exists
   
     1. The Problematic Method Has Been Removed
   
     The logical error you mentioned in the mergeEffectiveDataSources method did exist, but this method was completely removed in October 2023.
   
     The original problematic code:
   ```java
     } else if (DataSourcePropertiesCreator.create(localConfiguredDataSource).equals(persistedDataSourceProps)) {
         result.put(dataSourceName, localConfiguredDataSource);
     }
   ```
   
     2. New Solution Approach
   
     The current version of ShardingSphere uses a simpler and more direct configuration loading strategy:
   
   ```java
     public Map<String, DataSourceConfiguration> loadDataSourceConfigurations(final String databaseName) {
         return dataSourceUnitService.load(databaseName).entrySet().stream()
                 .collect(Collectors.toMap(Entry::getKey,
                         entry -> DataSourcePoolPropertiesCreator.createConfiguration(entry.getValue())));
     }
   ```
   
     3. Improvements from Architectural Optimization
   
     - Removed complex merge logic: No longer performs complex merging of local and persisted configurations
     - Simplified configuration management: Directly uses persisted configurations, avoiding logical errors
     - Enhanced stability: Reduces bugs caused by complex conditional judgments
   
     Recommendations
   
     Immediate Solution
   
     Upgrade to the latest version of ShardingSphere - this bug no longer exists.
   
     Long-term Benefits
   
     The new version's configuration management is more:
     - Simple and direct: Avoids complex merge logic
     - Stable and reliable: Reduces potential configuration conflicts
     - Easy to maintain: Code logic is clearer
   
     Summary
   
     The bug you discovered was real, but the ShardingSphere team fundamentally resolved this issue through architectural refactoring, adopting a simpler and more reliable configuration management strategy. I recommend
     upgrading to the latest version to get the fix.
   


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