Skip to content

Commit

Permalink
Refactor UnregisterStorageUnitBackendHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Sep 29, 2023
1 parent 629b0bb commit 8482fa8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public void checkSQLStatement(final String databaseName, final UnregisterStorage
}

private void checkExisted(final String databaseName, final Collection<String> storageUnitNames) {
Map<String, NewStorageUnitMetaData> storageUnits = ProxyContext.getInstance().getDatabase(databaseName).getResourceMetaData().getStorageUnitMetaData().getMetaDataMap();
Collection<String> notExistedStorageUnits = storageUnitNames.stream().filter(each -> !storageUnits.containsKey(each)).collect(Collectors.toList());
Map<String, NewStorageUnitMetaData> metaDataMap = ProxyContext.getInstance().getDatabase(databaseName).getResourceMetaData().getStorageUnitMetaData().getMetaDataMap();
Collection<String> notExistedStorageUnits = storageUnitNames.stream().filter(each -> !metaDataMap.containsKey(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistedStorageUnits.isEmpty(), () -> new MissingRequiredStorageUnitsException(databaseName, notExistedStorageUnits));
}

Expand Down

0 comments on commit 8482fa8

Please sign in to comment.