You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2020/11/11 10:54:23 UTC

[shardingsphere] branch master updated: Remove addressingDataSources (#8137)

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

panjuan 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 552af3e   Remove addressingDataSources (#8137)
552af3e is described below

commit 552af3ee5918de76b35d89f114032ebcc847ff49
Author: Liang Zhang <te...@163.com>
AuthorDate: Wed Nov 11 18:53:54 2020 +0800

     Remove addressingDataSources (#8137)
    
    * Remove TableMetaData.addressingDataSources
    
    * Remove YamlTableMetaData.addressingDataSources
    
    * Move SingleTableRule
    
    * Remove TableAddressingMapperBuilder
---
 .../governance/management/config-center.cn.md      |  3 -
 .../governance/management/config-center.en.md      |  3 -
 .../ShardingTableAddressingMapperDecorator.java    | 60 ---------------
 .../shardingsphere/sharding/rule/ShardingRule.java |  3 +-
 .../rule/{ => single}/SingleTableRule.java         |  2 +-
 .../single}/SingleTableRuleLoader.java             |  3 +-
 ...der.spi.RuleBasedTableAddressingMapperDecorator | 18 -----
 .../engine/fixture/AbstractRoutingEngineTest.java  |  2 +-
 .../type/single/SingleTableRoutingEngineTest.java  |  2 +-
 .../engine/type/standard/AbstractSQLRouteTest.java |  1 -
 .../core/yaml/config/schema/YamlTableMetaData.java |  4 -
 .../core/yaml/swapper/SchemaYamlSwapper.java       |  5 +-
 .../core/yaml/swapper/SchemaYamlSwapperTest.java   |  7 --
 .../src/test/resources/yaml/schema.yaml            |  3 -
 .../metadata/schema/builder/SchemaBuilder.java     | 19 -----
 .../builder/TableAddressingMapperBuilder.java      | 86 ----------------------
 .../RuleBasedTableAddressingMapperDecorator.java   | 40 ----------
 .../infra/metadata/schema/model/TableMetaData.java |  3 -
 .../type/CreateTableStatementSchemaRefresher.java  |  1 -
 .../type/CreateViewStatementSchemaRefresher.java   |  1 -
 20 files changed, 7 insertions(+), 259 deletions(-)

diff --git a/docs/document/content/features/governance/management/config-center.cn.md b/docs/document/content/features/governance/management/config-center.cn.md
index 8074320..92218e1 100644
--- a/docs/document/content/features/governance/management/config-center.cn.md
+++ b/docs/document/content/features/governance/management/config-center.cn.md
@@ -125,9 +125,6 @@ tables:                                       # 表
         generated: false
         name: order_id
         primaryKey: false
-  addressingDataSources:                      # 所在真实数据源名
-    - ds_0
-    - ds_1
 ```
 
 ## 动态生效
diff --git a/docs/document/content/features/governance/management/config-center.en.md b/docs/document/content/features/governance/management/config-center.en.md
index 05c9178..b094992 100644
--- a/docs/document/content/features/governance/management/config-center.en.md
+++ b/docs/document/content/features/governance/management/config-center.en.md
@@ -125,9 +125,6 @@ tables:                                       # Tables
         generated: false
         name: order_id
         primaryKey: false
-  addressingDataSources:                      # Actual data source names
-    - ds_0
-    - ds_1
 ```
 
 ## Dynamic Effectiveness
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/metadata/ShardingTableAddressingMapperDecorator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/metadata/ShardingTableAddressingMapperDecorator.java
deleted file mode 100644
index d27bf8f..0000000
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/metadata/ShardingTableAddressingMapperDecorator.java
+++ /dev/null
@@ -1,60 +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.sharding.metadata;
-
-import org.apache.shardingsphere.infra.datanode.DataNode;
-import org.apache.shardingsphere.infra.metadata.schema.builder.spi.RuleBasedTableAddressingMapperDecorator;
-import org.apache.shardingsphere.sharding.constant.ShardingOrder;
-import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import org.apache.shardingsphere.sharding.rule.TableRule;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * Table addressing mapper decorator of sharding.
- */
-public final class ShardingTableAddressingMapperDecorator implements RuleBasedTableAddressingMapperDecorator<ShardingRule> {
-    
-    @Override
-    public void decorate(final ShardingRule rule, final Map<String, Collection<String>> tableAddressingMapper) {
-        rule.getTableRules().forEach(each -> decorate(each, tableAddressingMapper));
-    }
-    
-    private void decorate(final TableRule tableRule, final Map<String, Collection<String>> tableDataSourceNamesMapper) {
-        boolean found = false;
-        for (String each : tableRule.getActualDataNodes().stream().map(DataNode::getTableName).collect(Collectors.toSet())) {
-            found = null != tableDataSourceNamesMapper.remove(each) || found;
-        }
-        if (found) {
-            tableDataSourceNamesMapper.put(tableRule.getLogicTable(), new LinkedList<>(tableRule.getActualDatasourceNames()));
-        }
-    }
-    
-    @Override
-    public int getOrder() {
-        return ShardingOrder.ORDER;
-    }
-    
-    @Override
-    public Class<ShardingRule> getTypeClass() {
-        return ShardingRule.class;
-    }
-}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
index 4077670..a01bf40 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
@@ -41,7 +41,8 @@ import org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShard
 import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
 import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
 import org.apache.shardingsphere.sharding.api.sharding.ShardingAutoTableAlgorithm;
-import org.apache.shardingsphere.sharding.metadata.SingleTableRuleLoader;
+import org.apache.shardingsphere.sharding.rule.single.SingleTableRule;
+import org.apache.shardingsphere.sharding.rule.single.SingleTableRuleLoader;
 import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
 import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
 
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/SingleTableRule.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/single/SingleTableRule.java
similarity index 94%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/SingleTableRule.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/single/SingleTableRule.java
index 5ec522d..436cb41 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/SingleTableRule.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/single/SingleTableRule.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.rule;
+package org.apache.shardingsphere.sharding.rule.single;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/metadata/SingleTableRuleLoader.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/single/SingleTableRuleLoader.java
similarity index 96%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/metadata/SingleTableRuleLoader.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/single/SingleTableRuleLoader.java
index 3174ee8..f9e7430 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/metadata/SingleTableRuleLoader.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/single/SingleTableRuleLoader.java
@@ -15,14 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.metadata;
+package org.apache.shardingsphere.sharding.rule.single;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.metadata.schema.builder.loader.SchemaMetaDataLoader;
-import org.apache.shardingsphere.sharding.rule.SingleTableRule;
 
 import javax.sql.DataSource;
 import java.sql.SQLException;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.schema.builder.spi.RuleBasedTableAddressingMapperDecorator b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.schema.builder.spi.RuleBasedTableAddressingMapperDecorator
deleted file mode 100644
index 2fdcde4..0000000
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.schema.builder.spi.RuleBasedTableAddressingMapperDecorator
+++ /dev/null
@@ -1,18 +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.
-#
-
-org.apache.shardingsphere.sharding.metadata.ShardingTableAddressingMapperDecorator
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/fixture/AbstractRoutingEngineTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/fixture/AbstractRoutingEngineTest.java
index 2e92fd9..0c148e2 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/fixture/AbstractRoutingEngineTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/fixture/AbstractRoutingEngineTest.java
@@ -29,7 +29,7 @@ import org.apache.shardingsphere.sharding.route.engine.condition.ShardingConditi
 import org.apache.shardingsphere.sharding.route.engine.condition.value.ListShardingConditionValue;
 import org.apache.shardingsphere.sharding.route.engine.condition.value.ShardingConditionValue;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import org.apache.shardingsphere.sharding.rule.SingleTableRule;
+import org.apache.shardingsphere.sharding.rule.single.SingleTableRule;
 
 import javax.sql.DataSource;
 import java.util.ArrayList;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/single/SingleTableRoutingEngineTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/single/SingleTableRoutingEngineTest.java
index d974db4..cffbce3 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/single/SingleTableRoutingEngineTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/single/SingleTableRoutingEngineTest.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.route.context.RouteMapper;
 import org.apache.shardingsphere.infra.route.context.RouteUnit;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import org.apache.shardingsphere.sharding.rule.SingleTableRule;
+import org.apache.shardingsphere.sharding.rule.single.SingleTableRule;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.ddl.MySQLCreateTableStatement;
 import org.junit.Test;
 
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
index a4cfaa9..c09380f 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
@@ -74,7 +74,6 @@ public abstract class AbstractSQLRouteTest extends AbstractRoutingEngineTest {
                 new ColumnMetaData("c_date", Types.TIMESTAMP, "timestamp", false, false, false)), Collections.emptySet()));
         tableMetaDataMap.put("t_other", new TableMetaData(Collections.singletonList(new ColumnMetaData("order_id", Types.INTEGER, "int", true, false, false)), Collections.emptySet()));
         tableMetaDataMap.put("t_category", new TableMetaData());
-        tableMetaDataMap.get("t_category").getAddressingDataSources().add("single_db");
         return new ShardingSphereSchema(tableMetaDataMap);
     }
 }
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/yaml/config/schema/YamlTableMetaData.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/yaml/config/schema/YamlTableMetaData.java
index e7e8005..6125b32 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/yaml/config/schema/YamlTableMetaData.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/yaml/config/schema/YamlTableMetaData.java
@@ -21,8 +21,6 @@ import lombok.Getter;
 import lombok.Setter;
 import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
 
-import java.util.Collection;
-import java.util.LinkedHashSet;
 import java.util.Map;
 
 /**
@@ -35,6 +33,4 @@ public final class YamlTableMetaData implements YamlConfiguration {
     private Map<String, YamlColumnMetaData> columns;
     
     private Map<String, YamlIndexMetaData> indexes;
-    
-    private Collection<String> addressingDataSources = new LinkedHashSet<>();
 }
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/SchemaYamlSwapper.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/SchemaYamlSwapper.java
index 8b9c131..10fe6ce 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/SchemaYamlSwapper.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/SchemaYamlSwapper.java
@@ -60,9 +60,7 @@ public final class SchemaYamlSwapper implements YamlSwapper<YamlSchema, Sharding
     }
     
     private TableMetaData convertTable(final YamlTableMetaData table) {
-        TableMetaData result = new TableMetaData(convertColumns(table.getColumns()), convertIndexes(table.getIndexes()));
-        result.getAddressingDataSources().addAll(table.getAddressingDataSources());
-        return result;
+        return new TableMetaData(convertColumns(table.getColumns()), convertIndexes(table.getIndexes()));
     }
     
     private Collection<IndexMetaData> convertIndexes(final Map<String, YamlIndexMetaData> indexes) {
@@ -85,7 +83,6 @@ public final class SchemaYamlSwapper implements YamlSwapper<YamlSchema, Sharding
         YamlTableMetaData result = new YamlTableMetaData();
         result.setColumns(convertYamlColumns(table.getColumns()));
         result.setIndexes(convertYamlIndexes(table.getIndexes()));
-        result.setAddressingDataSources(table.getAddressingDataSources());
         return result;
     }
     
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/java/org/apache/shardingsphere/governance/core/yaml/swapper/SchemaYamlSwapperTest.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/java/org/apache/shardingsphere/governance/core/yaml/swapper/SchemaYamlSwapperTest.java
index 6c3d44f..ea43734 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/java/org/apache/shardingsphere/governance/core/yaml/swapper/SchemaYamlSwapperTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/java/org/apache/shardingsphere/governance/core/yaml/swapper/SchemaYamlSwapperTest.java
@@ -33,7 +33,6 @@ import java.util.stream.Collectors;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
 
 public final class SchemaYamlSwapperTest {
     
@@ -47,9 +46,6 @@ public final class SchemaYamlSwapperTest {
         assertThat(yamlSchema.getTables().keySet(), is(Collections.singleton("t_order")));
         assertThat(yamlSchema.getTables().get("t_order").getIndexes().keySet(), is(Collections.singleton("primary")));
         assertThat(yamlSchema.getTables().get("t_order").getColumns().keySet(), is(Collections.singleton("id")));
-        assertThat(yamlSchema.getTables().get("t_order").getAddressingDataSources().size(), is(2));
-        assertTrue(yamlSchema.getTables().get("t_order").getAddressingDataSources().contains("ds_0"));
-        assertTrue(yamlSchema.getTables().get("t_order").getAddressingDataSources().contains("ds_1"));
     }
     
     @Test
@@ -60,9 +56,6 @@ public final class SchemaYamlSwapperTest {
         assertThat(schema.get("t_order").getIndexes().keySet(), is(Collections.singleton("primary")));
         assertThat(schema.getAllColumnNames("t_order").size(), is(1));
         assertThat(schema.get("t_order").getColumns().keySet(), is(Collections.singleton("id")));
-        assertThat(schema.get("t_order").getAddressingDataSources().size(), is(2));
-        assertTrue(schema.get("t_order").getAddressingDataSources().contains("ds_0"));
-        assertTrue(schema.get("t_order").getAddressingDataSources().contains("ds_1"));
     }
     
     @SneakyThrows({URISyntaxException.class, IOException.class})
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/resources/yaml/schema.yaml b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/resources/yaml/schema.yaml
index 32d485f..ec02090 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/resources/yaml/schema.yaml
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/resources/yaml/schema.yaml
@@ -27,6 +27,3 @@ tables:
     indexes:
        primary:
           name: PRIMARY
-    addressingDataSources:
-      - ds_0
-      - ds_1
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SchemaBuilder.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SchemaBuilder.java
index 1890036..cbd95f8 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SchemaBuilder.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SchemaBuilder.java
@@ -20,13 +20,10 @@ package org.apache.shardingsphere.infra.metadata.schema.builder;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
-import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.type.TableContainedRule;
 
 import java.sql.SQLException;
-import java.util.Collection;
-import java.util.Map.Entry;
 
 /**
  * Schema builder.
@@ -42,12 +39,6 @@ public final class SchemaBuilder {
      * @throws SQLException SQL exception
      */
     public static ShardingSphereSchema build(final SchemaBuilderMaterials materials) throws SQLException {
-        ShardingSphereSchema result = loadSchema(materials);
-        setTableAddressingMapper(materials, result);
-        return result;
-    }
-    
-    private static ShardingSphereSchema loadSchema(final SchemaBuilderMaterials materials) throws SQLException {
         ShardingSphereSchema result = new ShardingSphereSchema();
         for (ShardingSphereRule rule : materials.getRules()) {
             if (rule instanceof TableContainedRule) {
@@ -60,14 +51,4 @@ public final class SchemaBuilder {
         }
         return result;
     }
-    
-    private static void setTableAddressingMapper(final SchemaBuilderMaterials materials, final ShardingSphereSchema schema) throws SQLException {
-        for (Entry<String, Collection<String>> entry : TableAddressingMapperBuilder.build(materials).entrySet()) {
-            String tableName = entry.getKey();
-            if (!schema.containsTable(tableName)) {
-                schema.put(tableName, new TableMetaData());
-            }
-            schema.get(tableName).getAddressingDataSources().addAll(entry.getValue());
-        }
-    }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/TableAddressingMapperBuilder.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/TableAddressingMapperBuilder.java
deleted file mode 100644
index 281568e..0000000
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/TableAddressingMapperBuilder.java
+++ /dev/null
@@ -1,86 +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.metadata.schema.builder;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.metadata.schema.builder.loader.SchemaMetaDataLoader;
-import org.apache.shardingsphere.infra.metadata.schema.builder.spi.RuleBasedTableAddressingMapperDecorator;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
-import org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry;
-
-import javax.sql.DataSource;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * Table addressing mapper builder.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class TableAddressingMapperBuilder {
-    
-    static {
-        ShardingSphereServiceLoader.register(RuleBasedTableAddressingMapperDecorator.class);
-    }
-    
-    /**
-     * Build table addressing mapper with related data sources.
-     *
-     * @param materials schema builder materials
-     * @return table addressing mapper with related data sources
-     * @throws SQLException SQL exception
-     */
-    public static Map<String, Collection<String>> build(final SchemaBuilderMaterials materials) throws SQLException {
-        Map<String, Collection<String>> result = load(materials.getDatabaseType(), materials.getDataSourceMap());
-        decorate(materials.getRules(), result);
-        return result;
-    }
-    
-    @SuppressWarnings("CollectionWithoutInitialCapacity")
-    private static Map<String, Collection<String>> load(final DatabaseType databaseType, final Map<String, DataSource> dataSourceMap) throws SQLException {
-        Map<String, Collection<String>> result = new HashMap<>();
-        for (Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
-            append(result, databaseType, entry.getKey(), entry.getValue());
-        }
-        return result;
-    }
-    
-    @SuppressWarnings("CollectionWithoutInitialCapacity")
-    private static void append(final Map<String, Collection<String>> tableAddressingMapper,
-                               final DatabaseType databaseType, final String dataSourceName, final DataSource dataSource) throws SQLException {
-        for (String each : SchemaMetaDataLoader.loadAllTableNames(dataSource, databaseType)) {
-            if (!tableAddressingMapper.containsKey(each)) {
-                tableAddressingMapper.put(each, new LinkedHashSet<>());
-            }
-            tableAddressingMapper.get(each).add(dataSourceName);
-        }
-    }
-
-    @SuppressWarnings({"unchecked", "rawtypes"})
-    private static void decorate(final Collection<ShardingSphereRule> rules, final Map<String, Collection<String>> tableAddressingMapper) {
-        for (Entry<ShardingSphereRule, RuleBasedTableAddressingMapperDecorator> entry : OrderedSPIRegistry.getRegisteredServices(rules, RuleBasedTableAddressingMapperDecorator.class).entrySet()) {
-            entry.getValue().decorate(entry.getKey(), tableAddressingMapper);
-        }
-    }
-}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/spi/RuleBasedTableAddressingMapperDecorator.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/spi/RuleBasedTableAddressingMapperDecorator.java
deleted file mode 100644
index fcd2aad..0000000
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/spi/RuleBasedTableAddressingMapperDecorator.java
+++ /dev/null
@@ -1,40 +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.metadata.schema.builder.spi;
-
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-import org.apache.shardingsphere.infra.spi.ordered.OrderedSPI;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * Table addressing mapper decorator with related rule.
- * 
- * @param <T> type of ShardingSphere rule
- */
-public interface RuleBasedTableAddressingMapperDecorator<T extends ShardingSphereRule> extends OrderedSPI<T> {
-    
-    /**
-     * Decorate table addressing mapper with data source names.
-     *
-     * @param rule ShardingSphere rule
-     * @param tableAddressingMapper decorated table addressing mapper
-     */
-    void decorate(T rule, Map<String, Collection<String>> tableAddressingMapper);
-}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/model/TableMetaData.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/model/TableMetaData.java
index cb3a049..9438c3d 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/model/TableMetaData.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/model/TableMetaData.java
@@ -26,7 +26,6 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 
@@ -47,8 +46,6 @@ public final class TableMetaData {
     
     private final List<String> primaryKeyColumns = new ArrayList<>();
     
-    private final Collection<String> addressingDataSources = new LinkedHashSet<>();
-    
     public TableMetaData() {
         this(Collections.emptyList(), Collections.emptyList());
     }
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateTableStatementSchemaRefresher.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateTableStatementSchemaRefresher.java
index 63bb0ae..423a0cc 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateTableStatementSchemaRefresher.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateTableStatementSchemaRefresher.java
@@ -45,7 +45,6 @@ public final class CreateTableStatementSchemaRefresher implements SchemaRefreshe
             tableMetaData = new TableMetaData();
         }
         schema.put(tableName, tableMetaData);
-        schema.get(tableName).getAddressingDataSources().addAll(routeDataSourceNames);
     }
     
     private boolean containsInTableContainedRule(final String tableName, final SchemaBuilderMaterials materials) {
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateViewStatementSchemaRefresher.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateViewStatementSchemaRefresher.java
index 7a464d5..2230401 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateViewStatementSchemaRefresher.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateViewStatementSchemaRefresher.java
@@ -35,6 +35,5 @@ public final class CreateViewStatementSchemaRefresher implements SchemaRefresher
                         final Collection<String> routeDataSourceNames, final CreateViewStatement sqlStatement, final SchemaBuilderMaterials materials) {
         String viewName = sqlStatement.getView().getTableName().getIdentifier().getValue();
         schema.put(viewName, new TableMetaData());
-        schema.get(viewName).getAddressingDataSources().addAll(routeDataSourceNames);
     }
 }