You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2024/08/13 07:07:35 UTC

(shardingsphere) branch master updated: For #32487, fix load single table error after creating logical data source (#32489)

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

jiangmaolin 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 0d5e1698381 For #32487, fix load single table error after creating logical data source (#32489)
0d5e1698381 is described below

commit 0d5e169838123049a0a8f7ebb8370bcd6ba93ba9
Author: Raigor <ra...@gmail.com>
AuthorDate: Tue Aug 13 15:07:29 2024 +0800

    For #32487, fix load single table error after creating logical data source (#32489)
---
 .../single/decorator/SingleRuleConfigurationDecorator.java   | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/decorator/SingleRuleConfigurationDecorator.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/decorator/SingleRuleConfigurationDecorator.java
index 4eb6a573b2a..1661f06bd6c 100644
--- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/decorator/SingleRuleConfigurationDecorator.java
+++ b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/decorator/SingleRuleConfigurationDecorator.java
@@ -67,7 +67,6 @@ public final class SingleRuleConfigurationDecorator implements RuleConfiguration
         Collection<String> excludedTables = SingleTableLoadUtils.getExcludedTables(builtRules);
         Map<String, Collection<DataNode>> actualDataNodes = SingleTableDataNodeLoader.load(databaseName, aggregatedDataSources, excludedTables);
         Collection<DataNode> configuredDataNodes = SingleTableLoadUtils.convertToDataNodes(databaseName, databaseType, splitTables);
-        checkRuleConfiguration(databaseName, aggregatedDataSources, excludedTables, configuredDataNodes);
         boolean isSchemaSupportedDatabaseType = new DatabaseTypeRegistry(databaseType).getDialectDatabaseMetaData().getDefaultSchema().isPresent();
         if (splitTables.contains(SingleTableConstants.ALL_TABLES) || splitTables.contains(SingleTableConstants.ALL_SCHEMA_TABLES)) {
             return loadAllTables(isSchemaSupportedDatabaseType, actualDataNodes);
@@ -79,17 +78,6 @@ public final class SingleRuleConfigurationDecorator implements RuleConfiguration
         return splitTables.stream().anyMatch(each -> each.contains(SingleTableConstants.ASTERISK));
     }
     
-    private void checkRuleConfiguration(final String databaseName, final Map<String, DataSource> dataSources, final Collection<String> excludedTables, final Collection<DataNode> dataNodes) {
-        for (DataNode each : dataNodes) {
-            if (!SingleTableConstants.ASTERISK.equals(each.getDataSourceName())) {
-                ShardingSpherePreconditions.checkContainsKey(dataSources, each.getDataSourceName(),
-                        () -> new InvalidSingleRuleConfigurationException(String.format("Data source `%s` does not exist in database `%s`", each.getDataSourceName(), databaseName)));
-            }
-            ShardingSpherePreconditions.checkNotContains(excludedTables, each.getTableName(),
-                    () -> new InvalidSingleRuleConfigurationException(String.format("Table `%s` existed and is not a single table in database `%s`", each.getTableName(), databaseName)));
-        }
-    }
-    
     private Collection<String> loadAllTables(final boolean isSchemaSupportedDatabaseType, final Map<String, Collection<DataNode>> actualDataNodes) {
         return actualDataNodes.values().stream().map(each -> getTableNodeString(isSchemaSupportedDatabaseType, each.iterator().next())).collect(Collectors.toList());
     }