diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/ClusterMetaDataManagerPersistService.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/ClusterMetaDataManagerPersistService.java index 96c8080896e6d..d8cfce67a475b 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/ClusterMetaDataManagerPersistService.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/ClusterMetaDataManagerPersistService.java @@ -29,8 +29,8 @@ import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereView; import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatistics; import org.apache.shardingsphere.infra.metadata.version.MetaDataVersion; -import org.apache.shardingsphere.mode.manager.cluster.persist.coordinator.database.ClusterDatabaseListenerPersistCoordinator; import org.apache.shardingsphere.mode.manager.cluster.persist.coordinator.database.ClusterDatabaseListenerCoordinatorType; +import org.apache.shardingsphere.mode.manager.cluster.persist.coordinator.database.ClusterDatabaseListenerPersistCoordinator; import org.apache.shardingsphere.mode.metadata.MetaDataContextManager; import org.apache.shardingsphere.mode.metadata.MetaDataContexts; import org.apache.shardingsphere.mode.metadata.factory.MetaDataContextsFactory; @@ -111,7 +111,11 @@ public void alterSchemaName(final String databaseName, final String schemaName, @Override public void dropSchema(final String databaseName, final Collection schemaNames) { - schemaNames.forEach(each -> metaDataPersistService.getDatabaseMetaDataFacade().getSchema().drop(databaseName, each)); + schemaNames.forEach(each -> dropSchema(databaseName, each)); + } + + private void dropSchema(final String databaseName, final String schemaName) { + metaDataPersistService.getDatabaseMetaDataFacade().getSchema().drop(databaseName, schemaName); } @Override diff --git a/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/service/StandaloneMetaDataManagerPersistService.java b/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/service/StandaloneMetaDataManagerPersistService.java index 845d28ce9dbb9..17cf90f560df0 100644 --- a/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/service/StandaloneMetaDataManagerPersistService.java +++ b/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/service/StandaloneMetaDataManagerPersistService.java @@ -89,10 +89,7 @@ public void dropDatabase(final String databaseName) { @Override public void createSchema(final String databaseName, final String schemaName) { metaDataPersistService.getDatabaseMetaDataFacade().getSchema().add(databaseName, schemaName); - ShardingSphereMetaData metaData = metaDataContextManager.getMetaDataContexts().getMetaData(); - ShardingSphereDatabase database = metaData.getDatabase(databaseName); - database.addSchema(new ShardingSphereSchema(schemaName)); - metaData.getGlobalRuleMetaData().getRules().forEach(each -> ((GlobalRule) each).refresh(metaData.getAllDatabases(), GlobalRuleChangedType.SCHEMA_CHANGED)); + metaDataContextManager.getSchemaMetaDataManager().addSchema(databaseName, schemaName); } @Override @@ -201,7 +198,7 @@ private void removeViewsToDataNode(final ShardingSphereDatabase database, final @Override public void dropSchema(final String databaseName, final Collection schemaNames) { - schemaNames.forEach(schemaName -> dropSchema(databaseName, schemaName)); + schemaNames.forEach(each -> dropSchema(databaseName, each)); } private void dropSchema(final String databaseName, final String schemaName) {