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/03/24 10:02:28 UTC

[GitHub] [shardingsphere] taojintianxia commented on a change in pull request #16340: Adjust Goverence center structure to support three layers of metadata structure

taojintianxia commented on a change in pull request #16340:
URL: https://github.com/apache/shardingsphere/pull/16340#discussion_r834126974



##########
File path: shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
##########
@@ -149,10 +147,10 @@ private SchemaConfiguration createSchemaConfiguration(final String schemaName, f
         return new DataSourceProvidedSchemaConfiguration(dataSources, schemaRuleConfigs);
     }
     
-    private void persistMetaData(final MetaDataPersistService metaDataPersistService, final Map<String, ShardingSphereSchema> schemaMap) {
-        for (Entry<String, ShardingSphereSchema> entry : schemaMap.entrySet()) {
-            metaDataPersistService.getSchemaMetaDataService().persist(entry.getKey(), entry.getValue());
-        }
+    private void persistMetaData(final MetaDataPersistService metaDataPersistService, final Map<String, ShardingSphereDatabase> databaseMap) {
+        databaseMap.entrySet().forEach(entry ->
+                entry.getValue().getSchemas().entrySet().forEach(schema ->
+                        metaDataPersistService.getSchemaMetaDataService().persist(schema.getKey(), schema.getValue())));

Review comment:
       invoke an interface in a loop, why not design another signature which support Map from very beginning 




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