strongduanmu commented on a change in pull request #12125:
URL: https://github.com/apache/shardingsphere/pull/12125#discussion_r699761799



##########
File path: 
shardingsphere-infra/shardingsphere-infra-optimize/src/main/java/org/apache/shardingsphere/infra/optimize/core/metadata/FederateSchemaMetadata.java
##########
@@ -46,20 +46,22 @@ public FederateSchemaMetadata(final String name, final 
Map<String, TableMetaData
     
     /**
      * Renew.
+     * 
      * @param tableName table name
      * @param metaData meta data
      */
     @Synchronized
     public void renew(final String tableName, final TableMetaData metaData) {
-        tables.put(tableName, new FederateTableMetadata(tableName, metaData));
+        tables.put(tableName.toLowerCase(), new 
FederateTableMetadata(tableName, metaData));
     }
     
     /**
      * Remove.
+     * 
      * @param tableName table name
      */
     @Synchronized
     public void remove(final String tableName) {
-        tables.remove(tableName);
+        tables.remove(tableName.toLowerCase());
     }

Review comment:
       > Do we have to fix this issue by this one?
   
   @tristaZero This modification is not necessary to fix this issue, just to 
keep the same with the initial metadata processing way.
   
   ```java
   @Getter
   public final class FederateSchemaMetadatas {
       
       private final Map<String, FederateSchemaMetadata> schemas = new 
LinkedMap<>();
       
       public FederateSchemaMetadatas(final Map<String, ShardingSphereMetaData> 
metaDataMap) {
           for (Entry<String, ShardingSphereMetaData> each : 
metaDataMap.entrySet()) {
               schemas.put(each.getKey(), new 
FederateSchemaMetadata(each.getKey(), each.getValue().getSchema().getTables()));
           }
       }
   ...
   }
   ```
   
   When initializing FederateSchemaMetadata, the parameter 
`each.getValue().getSchema().getTables()` is a member variable of 
`ShardingSphereSchema`, and its key is uniformly processed to lowercase. If 
other methods are not processed to lowercase, use the case-insensitive dialects 
will occur wrong result when updating FederateSchemaMetadata.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to