Skip to content

Commit

Permalink
Remove DatabaseBasedPersistService
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed May 25, 2024
1 parent 55afe70 commit 6be1bdb
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
import java.sql.SQLException;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
Expand Down Expand Up @@ -179,8 +180,8 @@ private void removeViewsToDataNode(final ShardingSphereDatabase database, final

@Override
public void dropSchema(final String databaseName, final Collection<String> schemaNames) {
Collection<String> tobeRemovedTables = new LinkedHashSet<>();
Collection<String> tobeRemovedSchemas = new LinkedHashSet<>(schemaNames.size(), 1F);
Collection<String> tobeRemovedTables = new LinkedList<>();
Collection<String> tobeRemovedSchemas = new LinkedList<>();
ShardingSphereMetaData metaData = contextManager.getMetaDataContexts().getMetaData();
ShardingSphereDatabase database = metaData.getDatabase(databaseName);
for (String each : schemaNames) {
Expand All @@ -189,7 +190,7 @@ public void dropSchema(final String databaseName, final Collection<String> schem
Optional.of(schema).ifPresent(optional -> tobeRemovedTables.addAll(optional.getAllTableNames()));
tobeRemovedSchemas.add(each.toLowerCase());
}
removeDataNode(database.getRuleMetaData().getAttributes(MutableDataNodeRuleAttribute.class), tobeRemovedSchemas, tobeRemovedTables);
removeDataNode(database.getRuleMetaData().getAttributes(MutableDataNodeRuleAttribute.class), new HashSet<>(tobeRemovedSchemas), new HashSet<>(tobeRemovedTables));
metaData.getGlobalRuleMetaData().getRules().forEach(each -> ((GlobalRule) each).refresh(metaData.getDatabases(), GlobalRuleChangedType.SCHEMA_CHANGED));
}

Expand Down

0 comments on commit 6be1bdb

Please sign in to comment.