diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/ResourceSwitchManager.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/ResourceSwitchManager.java index 9354d96412caa..671d3d976d725 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/ResourceSwitchManager.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/ResourceSwitchManager.java @@ -48,14 +48,11 @@ public final class ResourceSwitchManager { * @return created switching resource */ public SwitchingResource create(final ResourceMetaData resourceMetaData, final Map toBeChangedPropsMap) { - Map mergedPropsMap = new LinkedHashMap<>(resourceMetaData.getStorageUnits().entrySet().stream() - .collect(Collectors.toMap(Entry::getKey, entry -> entry.getValue().getDataSourcePoolProperties(), (oldValue, currentValue) -> oldValue, LinkedHashMap::new))); - mergedPropsMap.putAll(toBeChangedPropsMap); Map toBeChangedStorageUnitNodeMap = StorageUnitNodeMapCreator.create(toBeChangedPropsMap); Map dataSourcePoolPropsMap = StorageNodeAggregator.aggregateDataSourcePoolProperties(toBeChangedPropsMap); Map newDataSources = createNewDataSources(resourceMetaData, toBeChangedStorageUnitNodeMap, dataSourcePoolPropsMap); - Map staleDataSources = getStaleDataSources(resourceMetaData, mergedPropsMap); - return new SwitchingResource(newDataSources, staleDataSources, getStaleStorageUnitNames(resourceMetaData, toBeChangedStorageUnitNodeMap), mergedPropsMap); + Map staleDataSources = getStaleDataSources(resourceMetaData, toBeChangedPropsMap); + return new SwitchingResource(newDataSources, staleDataSources, getStaleStorageUnitNames(resourceMetaData, toBeChangedStorageUnitNodeMap), toBeChangedPropsMap); } /** @@ -82,10 +79,6 @@ public SwitchingResource createByDropResource(final ResourceMetaData resourceMet * @return created switching resource */ public SwitchingResource createByAlterDataSourcePoolProperties(final ResourceMetaData resourceMetaData, final Map toBeChangedPropsMap) { - Map mergedDataSourcePoolPropsMap = new LinkedHashMap<>(resourceMetaData.getStorageUnits().entrySet().stream() - .collect(Collectors.toMap(Entry::getKey, entry -> entry.getValue().getDataSourcePoolProperties(), (oldValue, currentValue) -> oldValue, LinkedHashMap::new))); - mergedDataSourcePoolPropsMap.keySet().removeIf(each -> !toBeChangedPropsMap.containsKey(each)); - mergedDataSourcePoolPropsMap.putAll(toBeChangedPropsMap); Map toBeChangedStorageUnitNodeMap = StorageUnitNodeMapCreator.create(toBeChangedPropsMap); Map staleStorageDataSources = getStaleDataSources(resourceMetaData, toBeChangedPropsMap); staleStorageDataSources.putAll(getToBeDeletedDataSources(resourceMetaData.getDataSources(), toBeChangedStorageUnitNodeMap.values())); @@ -93,7 +86,7 @@ public SwitchingResource createByAlterDataSourcePoolProperties(final ResourceMet staleStorageUnitNames.addAll(getToBeDeletedStorageUnitNames(resourceMetaData.getStorageUnits(), toBeChangedStorageUnitNodeMap.keySet())); Map dataSourcePoolPropsMap = StorageNodeAggregator.aggregateDataSourcePoolProperties(toBeChangedPropsMap); return new SwitchingResource( - createNewDataSources(resourceMetaData, toBeChangedStorageUnitNodeMap, dataSourcePoolPropsMap), staleStorageDataSources, staleStorageUnitNames, mergedDataSourcePoolPropsMap); + createNewDataSources(resourceMetaData, toBeChangedStorageUnitNodeMap, dataSourcePoolPropsMap), staleStorageDataSources, staleStorageUnitNames, toBeChangedPropsMap); } private Map createNewDataSources(final ResourceMetaData resourceMetaData, final Map toBeChangedStorageUnitNodeMap, diff --git a/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/mysql/show_storage_units.xml b/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/mysql/show_storage_units.xml index 1726532a2f06c..bf142cb395e6c 100644 --- a/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/mysql/show_storage_units.xml +++ b/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/mysql/show_storage_units.xml @@ -30,25 +30,25 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/opengauss/show_storage_units.xml b/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/opengauss/show_storage_units.xml deleted file mode 100644 index 7e70c30d3d2cf..0000000000000 --- a/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/opengauss/show_storage_units.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/postgresql/show_storage_units.xml b/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/postgresql/show_storage_units.xml deleted file mode 100644 index 3d3e9c711b92c..0000000000000 --- a/test/e2e/sql/src/test/resources/cases/ral/dataset/empty_rules/postgresql/show_storage_units.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -