This is an automated email from the ASF dual-hosted git repository.

sunnianjun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new b0981dc3320 Remove unreasonable validation (#28126)
b0981dc3320 is described below

commit b0981dc3320f07c3ad9d4c46ae243a1c6084be78
Author: zhaojinchao <[email protected]>
AuthorDate: Wed Aug 16 22:16:21 2023 +0800

    Remove unreasonable validation (#28126)
---
 ...terReadwriteSplittingStorageUnitStatusStatementUpdater.java | 10 ----------
 1 file changed, 10 deletions(-)

diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/AlterReadwriteSplittingStorageUnitStatusStatementUpdater.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/AlterReadwriteSplittingStorageUnitStatusStatementUpdater.java
index ef03ba6ca1f..069043ca8c3 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/AlterReadwriteSplittingStorageUnitStatusStatementUpdater.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/AlterReadwriteSplittingStorageUnitStatusStatementUpdater.java
@@ -148,7 +148,6 @@ public final class 
AlterReadwriteSplittingStorageUnitStatusStatementUpdater impl
         checkResourceExists(contextManager, databaseName, 
toBeDisabledStorageUnit);
         checkIsDisabled(replicaResources, disabledStorageUnits, 
toBeDisabledStorageUnit);
         checkIsReplicaResource(replicaResources, toBeDisabledStorageUnit);
-        checkIsLastResource(replicaResources, toBeDisabledStorageUnit);
     }
     
     private void checkIsDisabled(final Map<String, String> replicaResources, 
final Collection<String> disabledStorageUnits, final String 
toBeDisabledStorageUnit) {
@@ -162,15 +161,6 @@ public final class 
AlterReadwriteSplittingStorageUnitStatusStatementUpdater impl
                 () -> new UnsupportedSQLOperationException(String.format("`%s` 
is not used as a read storage unit by any read-write separation rules,cannot be 
disabled", toBeDisabledStorageUnit)));
     }
     
-    private void checkIsLastResource(final Map<String, String> 
replicaStorageUnits, final String toBeDisabledStorageUnit) {
-        Collection<String> onlyOneResourceRules = 
getOnlyOneResourceRules(replicaStorageUnits);
-        Collection<String> toBeDisabledResourceRuleNames = 
Splitter.on(",").trimResults().splitToList(replicaStorageUnits.get(toBeDisabledStorageUnit));
-        onlyOneResourceRules = 
onlyOneResourceRules.stream().filter(toBeDisabledResourceRuleNames::contains).collect(Collectors.toSet());
-        Collection<String> finalOnlyOneResourceRules = onlyOneResourceRules;
-        ShardingSpherePreconditions.checkState(onlyOneResourceRules.isEmpty(),
-                () -> new UnsupportedSQLOperationException(String.format("`%s` 
is the last read storage unit in `%s`, cannot be disabled", 
toBeDisabledStorageUnit, finalOnlyOneResourceRules)));
-    }
-    
     private Collection<String> getGroupNames(final String 
toBeDisableStorageUnit, final Map<String, String> replicaStorageUnits,
                                              final Map<String, String> 
disabledStorageUnits, final Map<String, String> autoAwareResources) {
         String groupNames = 
autoAwareResources.getOrDefault(toBeDisableStorageUnit, 
replicaStorageUnits.getOrDefault(toBeDisableStorageUnit, 
disabledStorageUnits.get(toBeDisableStorageUnit)));

Reply via email to