You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/04/23 13:34:14 UTC

[shardingsphere] branch master updated: remove multiple data source aggregation features (#16995) (#17034)

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

zhangliang 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 a43fc24bc53 remove multiple data source aggregation features (#16995) (#17034)
a43fc24bc53 is described below

commit a43fc24bc53a1632506f2a071d8623c07f49b8ad
Author: galaxy <ga...@tencent.com>
AuthorDate: Sat Apr 23 21:33:56 2022 +0800

    remove multiple data source aggregation features (#16995) (#17034)
---
 .../config/props/ConfigurationPropertyKey.java     |  5 --
 .../pool/creator/DataSourcePoolCreator.java        | 16 -----
 .../datasource/props/DataSourceProperties.java     | 82 ----------------------
 .../registry/GlobalDataSourceRegistry.java         |  6 --
 .../infra/datasource/registry/Instance.java        | 35 ---------
 .../rule/builder/schema/SchemaRulesBuilder.java    | 32 ---------
 ...gSpherePipelineDataSourceConfigurationTest.java | 26 -------
 .../jdbc/datasource/JDBCBackendDataSource.java     |  8 ---
 .../swapper/YamlProxyConfigurationSwapper.java     |  9 +--
 .../YamlProxyDataSourceConfigurationSwapper.java   | 18 +----
 .../ImportDatabaseConfigurationHandler.java        |  3 +-
 ...amlProxyDataSourceConfigurationSwapperTest.java |  2 +-
 .../src/main/resources/conf/server.yaml            |  1 -
 13 files changed, 6 insertions(+), 237 deletions(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
index ddb76dbd540..b3e257b79de 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
@@ -119,11 +119,6 @@ public enum ConfigurationPropertyKey implements TypedPropertyKey {
      */
     PROXY_BACKEND_DRIVER_TYPE("proxy-backend-driver-type", "JDBC", String.class, true),
     
-    /**
-     * Whether enable data source aggregation, default false.
-     */
-    DATA_SOURCE_AGGREGATION_ENABLED("data-source-aggregation-enabled", String.valueOf(Boolean.FALSE), boolean.class, false),
-    
     /**
      * Proxy mysql default version, default 5.7.22.
      */
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreator.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreator.java
index 21dd9739b79..9df94805b9e 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreator.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreator.java
@@ -61,11 +61,6 @@ public final class DataSourcePoolCreator {
      * @return created data source
      */
     public static DataSource create(final DataSourceProperties dataSourceProps) {
-        if (isCanBeDataSourceAggregation(dataSourceProps)) {
-            if (GlobalDataSourceRegistry.getInstance().getCachedInstanceDataSources().containsKey(dataSourceProps.getInstance())) {
-                return GlobalDataSourceRegistry.getInstance().getCachedInstanceDataSources().get(dataSourceProps.getInstance());
-            }
-        }
         // TODO when aggregation is enabled, some data source properties should be changed, e.g. maxPoolSize
         DataSource result = createDataSource(dataSourceProps.getDataSourceClassName());
         Optional<DataSourcePoolMetaData> poolMetaData = DataSourcePoolMetaDataFactory.newInstance(dataSourceProps.getDataSourceClassName());
@@ -78,9 +73,6 @@ public final class DataSourcePoolCreator {
         } else {
             setConfiguredFields(dataSourceProps, dataSourceReflection);
         }
-        if (isCanBeDataSourceAggregation(dataSourceProps)) {
-            GlobalDataSourceRegistry.getInstance().getCachedInstanceDataSources().put(dataSourceProps.getInstance(), result);
-        }
         return result;
     }
     
@@ -141,12 +133,4 @@ public final class DataSourcePoolCreator {
             }
         }
     }
-    
-    private static boolean isCanBeDataSourceAggregation(final DataSourceProperties dataSourceProps) {
-        if (!dataSourceProps.getConnectionPropertySynonyms().getLocalProperties().containsKey("jdbcUrl")) {
-            return false;
-        }
-        String jdbcUrlProp = (String) dataSourceProps.getConnectionPropertySynonyms().getLocalProperties().get("jdbcUrl");
-        return jdbcUrlProp.contains("jdbc:mysql") && GlobalDataSourceRegistry.getInstance().isDataSourceAggregationEnabled();
-    }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourceProperties.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourceProperties.java
index 681dd1312f9..66154000cc4 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourceProperties.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourceProperties.java
@@ -19,14 +19,11 @@ package org.apache.shardingsphere.infra.datasource.props;
 
 import com.google.common.base.Objects;
 import lombok.Getter;
-import org.apache.shardingsphere.infra.database.metadata.url.JdbcUrl;
-import org.apache.shardingsphere.infra.database.metadata.url.StandardJdbcUrlParser;
 import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData;
 import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaDataFactory;
 import org.apache.shardingsphere.infra.datasource.props.custom.CustomDataSourceProperties;
 import org.apache.shardingsphere.infra.datasource.props.synonym.ConnectionPropertySynonyms;
 import org.apache.shardingsphere.infra.datasource.props.synonym.PoolPropertySynonyms;
-import org.apache.shardingsphere.infra.datasource.registry.Instance;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -122,83 +119,4 @@ public final class DataSourceProperties {
         }
         return Objects.hashCode(dataSourceClassName, stringBuilder.toString());
     }
-    
-    /**
-     * Can data source be aggregate.
-     *
-     * @param dataSourceProperties data source properties
-     * @throws InvalidDataSourcePropertiesException invalid data source properties exception
-     */
-    public void checkToBeAggregatedDataSources(final DataSourceProperties dataSourceProperties) throws InvalidDataSourcePropertiesException {
-        if (!parseJdbcUrl().contains("jdbc:mysql")) {
-            return;
-        }
-        for (Entry<String, Object> entry : getAllLocalProperties().entrySet()) {
-            if (!dataSourceProperties.getAllLocalProperties().containsKey(entry.getKey())) {
-                String msg = "target data source item: " + entry.getKey() + ", not in source data source: " + dataSourceProperties.getAllLocalProperties();
-                throw new InvalidDataSourcePropertiesException(dataSourceProperties.getDataSourceClassName(), msg);
-            }
-            if (entry.getKey().equals("jdbcUrl") && !isInSameDatabaseInstance(String.valueOf(entry.getValue()),
-                    String.valueOf(dataSourceProperties.getAllLocalProperties().get(entry.getKey())))) {
-                String msg = "target data source item: " + entry.getValue() + ", not equal source in data source: " + dataSourceProperties.getAllLocalProperties().get(entry.getKey());
-                throw new InvalidDataSourcePropertiesException(dataSourceProperties.getDataSourceClassName(), msg);
-            }
-            if (!entry.getKey().equals("jdbcUrl") && !String.valueOf(entry.getValue()).equals(String.valueOf(dataSourceProperties.getAllLocalProperties().get(entry.getKey())))) {
-                String msg = "target data source item: " + entry.getKey() + ", value: " + entry.getValue() + ", not equal source item: " + entry.getKey() + ",data source:"
-                        + dataSourceProperties.getAllLocalProperties().get(entry.getKey());
-                throw new InvalidDataSourcePropertiesException(dataSourceProperties.getDataSourceClassName(), msg);
-            }
-        }
-    }
-    
-    /**
-     * Is data source in same instance.
-     *
-     * @param sourceUrl source url
-     * @param targetUrl target url
-     * @return boolean
-     */
-    public boolean isInSameDatabaseInstance(final String sourceUrl, final String targetUrl) {
-        if (sourceUrl.equals(targetUrl)) {
-            return true;
-        }
-        JdbcUrl sourceJdbcUrl = parseStandardJdbcUrlParserByJdbcUrl(sourceUrl);
-        JdbcUrl targetJdbcUrl = parseStandardJdbcUrlParserByJdbcUrl(targetUrl);
-        return sourceJdbcUrl.getHostname().equals(targetJdbcUrl.getHostname()) && sourceJdbcUrl.getPort() == targetJdbcUrl.getPort()
-                && sourceJdbcUrl.getQueryProperties().equals(targetJdbcUrl.getQueryProperties());
-    }
-    
-    private JdbcUrl parseStandardJdbcUrlParserByJdbcUrl(final String jdbcUrl) {
-        StandardJdbcUrlParser jdbcUrlParser = new StandardJdbcUrlParser();
-        return jdbcUrlParser.parse(jdbcUrl);
-    }
-    
-    private String parseJdbcUrl() {
-        for (Entry<String, Object> entry : getAllLocalProperties().entrySet()) {
-            if (entry.getKey().equals("jdbcUrl")) {
-                return String.valueOf(entry.getValue());
-            }
-        }
-        return "";
-    }
-    
-    /**
-     * Get instance from data source.
-     *
-     * @return Instance
-     */
-    public Instance getInstance() {
-        JdbcUrl jdbcUrl = parseStandardJdbcUrlParserByJdbcUrl(parseJdbcUrl());
-        return new Instance(jdbcUrl.getHostname(), jdbcUrl.getPort());
-    }
-    
-    /**
-     * Get database from data source.
-     *
-     * @return database
-     */
-    public String getDatabase() {
-        JdbcUrl jdbcUrl = parseStandardJdbcUrlParserByJdbcUrl(parseJdbcUrl());
-        return jdbcUrl.getDatabase();
-    }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/registry/GlobalDataSourceRegistry.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/registry/GlobalDataSourceRegistry.java
index c297ee4cb14..289299d096c 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/registry/GlobalDataSourceRegistry.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/registry/GlobalDataSourceRegistry.java
@@ -36,16 +36,10 @@ public final class GlobalDataSourceRegistry {
     
     private static final GlobalDataSourceRegistry INSTANCE = new GlobalDataSourceRegistry();
     
-    private volatile Map<Instance, DataSource> cachedInstanceDataSources = new LinkedHashMap<>();
-    
     private volatile Map<String, DataSource> cachedDataSourceDataSources = new LinkedHashMap<>();
     
     private volatile Map<String, String> cachedDatabaseTables = new LinkedHashMap<>();
     
-    private volatile Map<String, String> dataSourceSchema = new LinkedHashMap<>();
-    
-    private volatile boolean dataSourceAggregationEnabled;
-    
     /**
      * Get global data source.
      *
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/registry/Instance.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/registry/Instance.java
deleted file mode 100644
index 12539ad34f0..00000000000
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/registry/Instance.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.datasource.registry;
-
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * Instance.
- */
-@RequiredArgsConstructor
-@Getter
-@EqualsAndHashCode
-public final class Instance {
-    
-    private final String ip;
-    
-    private final Integer port;
-}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilder.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilder.java
index 260e44cfff0..e28fa805aad 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilder.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilder.java
@@ -20,15 +20,10 @@ package org.apache.shardingsphere.infra.rule.builder.schema;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
-import org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
 import org.apache.shardingsphere.infra.config.function.DistributedRuleConfiguration;
 import org.apache.shardingsphere.infra.config.function.EnhancedRuleConfiguration;
 import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
 import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
-import org.apache.shardingsphere.infra.config.database.impl.DataSourceGeneratedDatabaseConfiguration;
-import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
-import org.apache.shardingsphere.infra.datasource.props.InvalidDataSourcePropertiesException;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
 import org.apache.shardingsphere.spi.type.ordered.OrderedSPIRegistry;
@@ -64,12 +59,7 @@ public final class SchemaRulesBuilder {
     @SuppressWarnings({"unchecked", "rawtypes"})
     public static Collection<ShardingSphereRule> buildRules(final String databaseName, final DatabaseConfiguration databaseConfig, final ConfigurationProperties props) {
         Collection<ShardingSphereRule> result = new LinkedList<>();
-        boolean isDataSourceAggregation = props.getProps().containsKey("data-source-aggregation-enabled") ? props.getValue(ConfigurationPropertyKey.DATA_SOURCE_AGGREGATION_ENABLED) : false;
         for (Entry<RuleConfiguration, SchemaRuleBuilder> entry : getRuleBuilderMap(databaseConfig).entrySet()) {
-            if (isDataSourceAggregation) {
-                DataSourceGeneratedDatabaseConfiguration configuration = (DataSourceGeneratedDatabaseConfiguration) databaseConfig;
-                checkDataSourceAggregations(configuration.getDataSourceProperties());
-            }
             result.add(entry.getValue().build(entry.getKey(), databaseName, databaseConfig.getDataSources(), result, props));
         }
         return result;
@@ -117,26 +107,4 @@ public final class SchemaRulesBuilder {
         Collection<Class<SchemaRuleBuilder>> configuredBuilderClasses = configuredBuilders.stream().map(each -> (Class<SchemaRuleBuilder>) each.getClass()).collect(Collectors.toSet());
         return OrderedSPIRegistry.getRegisteredServices(SchemaRuleBuilder.class).stream().filter(each -> !configuredBuilderClasses.contains(each.getClass())).collect(Collectors.toList());
     }
-    
-    private static void checkDataSourceAggregations(final Map<String, DataSourceProperties> dataSourceProperties) {
-        for (Entry<String, DataSourceProperties> sourcePropertiesEntry : dataSourceProperties.entrySet()) {
-            for (Entry<String, DataSourceProperties> targetPropertiesEntry : dataSourceProperties.entrySet()) {
-                doCheckDataSourceAggregations(sourcePropertiesEntry.getValue(), targetPropertiesEntry.getValue());
-            }
-        }
-    }
-    
-    private static void doCheckDataSourceAggregations(final DataSourceProperties sourceProperties, final DataSourceProperties targetProperties) {
-        if (sourceProperties.equals(targetProperties)) {
-            return;
-        }
-        if (!sourceProperties.getInstance().equals(targetProperties.getInstance())) {
-            return;
-        }
-        try {
-            sourceProperties.checkToBeAggregatedDataSources(targetProperties);
-        } catch (final InvalidDataSourcePropertiesException ex) {
-            throw new ShardingSphereConfigurationException(ex);
-        }
-    }
 }
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-spi/src/test/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/ShardingSpherePipelineDataSourceConfigurationTest.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-spi/src/test/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/ShardingSpherePipelineDataSourceConfigurationTest.java
index 6065be01232..c522bb89e19 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-spi/src/test/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/ShardingSpherePipelineDataSourceConfigurationTest.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-spi/src/test/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/ShardingSpherePipelineDataSourceConfigurationTest.java
@@ -18,7 +18,6 @@
 package org.apache.shardingsphere.data.pipeline.api.datasource.config.impl;
 
 import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
-import org.apache.shardingsphere.infra.datasource.props.InvalidDataSourcePropertiesException;
 import org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper;
 import org.junit.Test;
 
@@ -30,7 +29,6 @@ import java.util.LinkedHashMap;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
 
 public final class ShardingSpherePipelineDataSourceConfigurationTest {
     
@@ -60,28 +58,4 @@ public final class ShardingSpherePipelineDataSourceConfigurationTest {
         yamlDataSourceConfigs.forEach((key, value) -> result.put(key, new YamlDataSourceConfigurationSwapper().swapToDataSourceProperties(value)));
         return result;
     }
-    
-    @Test
-    public void assertDataSourceCanBeAggregation() throws InvalidDataSourcePropertiesException {
-        ShardingSpherePipelineDataSourceConfiguration dataSourceConfig = new ShardingSpherePipelineDataSourceConfiguration(getDataSourceAggregationYaml());
-        List<DataSourceProperties> actual = new LinkedList<>(getDataSourcePropertiesMap(dataSourceConfig.getRootConfig().getDataSources()).values());
-        assertTrue(actual.get(0).isInSameDatabaseInstance(actual.get(0).getAllLocalProperties().get("jdbcUrl").toString(), actual.get(1).getAllLocalProperties().get("jdbcUrl").toString()));
-        actual.get(0).checkToBeAggregatedDataSources(actual.get(1));
-    }
-    
-    private String getDataSourceAggregationYaml() {
-        return "dataSources:\n"
-                + "  ds_1:\n"
-                + "    dataSourceClassName: com.zaxxer.hikari.HikariDataSource\n"
-                + "    url: jdbc:mysql://192.168.0.1:3306/scaling?serverTimezone=UTC&useSSL=false\n"
-                + "    username: root\n"
-                + "    password:\n"
-                + "    connectionTimeoutMilliseconds: 30000\n"
-                + "  ds_0:\n"
-                + "    dataSourceClassName: com.zaxxer.hikari.HikariDataSource\n"
-                + "    url: jdbc:mysql://192.168.0.1:3306/test?serverTimezone=UTC&useSSL=false\n"
-                + "    username: root\n"
-                + "    password: \n"
-                + "    connectionTimeoutMilliseconds: 30000\n";
-    }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java
index 6f7fb8031a6..6393743c1ff 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java
@@ -18,7 +18,6 @@
 package org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource;
 
 import com.google.common.base.Preconditions;
-import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
 import org.apache.shardingsphere.infra.datasource.registry.GlobalDataSourceRegistry;
 import org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
@@ -108,14 +107,7 @@ public final class JDBCBackendDataSource implements BackendDataSource {
     private Connection createConnection(final String schemaName, final String dataSourceName, final DataSource dataSource, final TransactionType transactionType) throws SQLException {
         ShardingSphereTransactionManager transactionManager =
                 ProxyContext.getInstance().getContextManager().getTransactionContexts().getEngines().get(schemaName).getTransactionManager(transactionType);
-        boolean isDataSourceAggregation = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getProps().getProps().containsKey("data-source-aggregation-enabled")
-                ? ProxyContext.getInstance().getContextManager().getMetaDataContexts().getProps().getValue(ConfigurationPropertyKey.DATA_SOURCE_AGGREGATION_ENABLED)
-                : false;
         Connection result = isInTransaction(transactionManager) ? transactionManager.getConnection(dataSourceName) : dataSource.getConnection();
-        if (isDataSourceAggregation) {
-            String databaseName = GlobalDataSourceRegistry.getInstance().getDataSourceSchema().get(schemaName + "." + dataSourceName);
-            result.setCatalog(databaseName);
-        }
         if (dataSourceName.contains(".")) {
             String databaseName = dataSourceName.split("\\.")[1];
             result.setCatalog(databaseName);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
index 237339df3c0..7d9881ba737 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
@@ -56,22 +56,19 @@ public final class YamlProxyConfigurationSwapper {
     
     private Map<String, DataSourceGeneratedDatabaseConfiguration> swapDatabaseConfigurations(final YamlProxyConfiguration yamlConfig) {
         Map<String, DataSourceGeneratedDatabaseConfiguration> result = new LinkedHashMap<>(yamlConfig.getDatabaseConfigurations().size(), 1);
-        boolean isDataSourceAggregation = yamlConfig.getServerConfiguration().getProps().containsKey("data-source-aggregation-enabled")
-                && (boolean) yamlConfig.getServerConfiguration().getProps().get("data-source-aggregation-enabled");
         for (Entry<String, YamlProxyDatabaseConfiguration> entry : yamlConfig.getDatabaseConfigurations().entrySet()) {
             Map<String, DataSourceConfiguration> databaseDataSourceConfigs =
-                    swapDataSourceConfigurations(entry.getValue().getDataSources(), entry.getValue().getDatabaseName(), isDataSourceAggregation);
+                    swapDataSourceConfigurations(entry.getValue().getDataSources(), entry.getValue().getDatabaseName());
             Collection<RuleConfiguration> databaseRuleConfigs = ruleConfigSwapperEngine.swapToRuleConfigurations(entry.getValue().getRules());
             result.put(entry.getKey(), new DataSourceGeneratedDatabaseConfiguration(databaseDataSourceConfigs, databaseRuleConfigs));
         }
         return result;
     }
     
-    private Map<String, DataSourceConfiguration> swapDataSourceConfigurations(final Map<String, YamlProxyDataSourceConfiguration> yamlConfigs, final String databaseName,
-                                                                              final boolean isDataSourceAggregation) {
+    private Map<String, DataSourceConfiguration> swapDataSourceConfigurations(final Map<String, YamlProxyDataSourceConfiguration> yamlConfigs, final String databaseName) {
         Map<String, DataSourceConfiguration> result = new LinkedHashMap<>(yamlConfigs.size(), 1);
         for (Entry<String, YamlProxyDataSourceConfiguration> entry : yamlConfigs.entrySet()) {
-            result.put(entry.getKey(), dataSourceConfigSwapper.swap(entry.getValue(), databaseName, entry.getKey(), isDataSourceAggregation));
+            result.put(entry.getKey(), dataSourceConfigSwapper.swap(entry.getValue()));
         }
         return result;
     }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapper.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapper.java
index f19aab6c740..ff12fac2f47 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapper.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapper.java
@@ -17,11 +17,9 @@
 
 package org.apache.shardingsphere.proxy.backend.config.yaml.swapper;
 
-import org.apache.shardingsphere.infra.database.metadata.url.StandardJdbcUrlParser;
 import org.apache.shardingsphere.infra.datasource.config.ConnectionConfiguration;
 import org.apache.shardingsphere.infra.datasource.config.DataSourceConfiguration;
 import org.apache.shardingsphere.infra.datasource.config.PoolConfiguration;
-import org.apache.shardingsphere.infra.datasource.registry.GlobalDataSourceRegistry;
 import org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDataSourceConfiguration;
 
 /**
@@ -33,15 +31,9 @@ public final class YamlProxyDataSourceConfigurationSwapper {
      * Swap YAML proxy data source configuration to data source configuration.
      *
      * @param yamlConfig YAML proxy data source configuration
-     * @param databaseName database name
-     * @param dataSourceName data source name
-     * @param isDataSourceAggregation is data source aggregation
      * @return data source configuration
      */
-    public DataSourceConfiguration swap(final YamlProxyDataSourceConfiguration yamlConfig, final String databaseName, final String dataSourceName, final boolean isDataSourceAggregation) {
-        if (isDataSourceAggregation) {
-            setGlobalDataSourceSchema(databaseName, dataSourceName, yamlConfig.getUrl());
-        }
+    public DataSourceConfiguration swap(final YamlProxyDataSourceConfiguration yamlConfig) {
         return new DataSourceConfiguration(swapConnectionConfiguration(yamlConfig), swapPoolConfiguration(yamlConfig));
     }
     
@@ -53,12 +45,4 @@ public final class YamlProxyDataSourceConfigurationSwapper {
         return new PoolConfiguration(yamlConfig.getConnectionTimeoutMilliseconds(), yamlConfig.getIdleTimeoutMilliseconds(),
                 yamlConfig.getMaxLifetimeMilliseconds(), yamlConfig.getMaxPoolSize(), yamlConfig.getMinPoolSize(), yamlConfig.getReadOnly(), yamlConfig.getCustomPoolProps());
     }
-    
-    private void setGlobalDataSourceSchema(final String databaseName, final String dataSourceName, final String jdbcUrl) {
-        String key = databaseName + "." + dataSourceName;
-        StandardJdbcUrlParser jdbcUrlParser = new StandardJdbcUrlParser();
-        String value = jdbcUrlParser.parse(jdbcUrl).getDatabase();
-        GlobalDataSourceRegistry.getInstance().getDataSourceSchema().put(key, value);
-        GlobalDataSourceRegistry.getInstance().setDataSourceAggregationEnabled(true);
-    }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/ImportDatabaseConfigurationHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/ImportDatabaseConfigurationHandler.java
index c45d1be7024..521655c73c1 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/ImportDatabaseConfigurationHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/ImportDatabaseConfigurationHandler.java
@@ -89,8 +89,7 @@ public final class ImportDatabaseConfigurationHandler extends UpdatableRALBacken
     private void alterResourcesConfig(final String databaseName, final Map<String, YamlProxyDataSourceConfiguration> yamlDataSourceMap) throws DistSQLException {
         Map<String, DataSourceProperties> toBeUpdatedResourcePropsMap = new LinkedHashMap<>(yamlDataSourceMap.size(), 1);
         for (Entry<String, YamlProxyDataSourceConfiguration> each : yamlDataSourceMap.entrySet()) {
-            DataSourceProperties dataSourceProps = DataSourcePropertiesCreator.create(HikariDataSource.class.getName(), dataSourceConfigSwapper.swap(each.getValue(), databaseName, each.getKey(),
-                    false));
+            DataSourceProperties dataSourceProps = DataSourcePropertiesCreator.create(HikariDataSource.class.getName(), dataSourceConfigSwapper.swap(each.getValue()));
             toBeUpdatedResourcePropsMap.put(each.getKey(), dataSourceProps);
         }
         try {
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapperTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapperTest.java
index 3a3e2a50d95..38bcfa56b8f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapperTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapperTest.java
@@ -38,7 +38,7 @@ public final class YamlProxyDataSourceConfigurationSwapperTest {
     public void assertSwap() throws IOException {
         YamlProxyConfiguration yamlProxyConfig = ProxyConfigurationLoader.load("/conf/swap");
         YamlProxyDataSourceConfiguration yamlProxyDataSourceConfig = yamlProxyConfig.getDatabaseConfigurations().get("swapper_test").getDataSources().get("foo_db");
-        DataSourceConfiguration actualDataSourceConfig = new YamlProxyDataSourceConfigurationSwapper().swap(yamlProxyDataSourceConfig, "swapper_test", "foo_db", false);
+        DataSourceConfiguration actualDataSourceConfig = new YamlProxyDataSourceConfigurationSwapper().swap(yamlProxyDataSourceConfig);
         assertConnectionConfig(actualDataSourceConfig);
         assertPoolConfig(actualDataSourceConfig);
     }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
index ce6ba074687..7b06e5205d2 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
@@ -81,5 +81,4 @@
 #  sql-federation-enabled: false
 #    # Available proxy backend driver type: JDBC (default), ExperimentalVertx
 #  proxy-backend-driver-type: JDBC
-#  data-source-aggregation-enabled: false
 #  proxy-mysql-default-version: 5.7.22 # In the absence of schema name, the default version will be used.