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 2022/11/04 07:55:53 UTC

[shardingsphere] branch master updated: add check when create sharding table reference rule (#21952)

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

jianglongtao 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 e29cd5eb58e add check when create sharding table reference rule (#21952)
e29cd5eb58e is described below

commit e29cd5eb58ed66156838669de71d7e3c40f18da2
Author: jiangML <10...@qq.com>
AuthorDate: Fri Nov 4 15:55:40 2022 +0800

    add check when create sharding table reference rule (#21952)
    
    * add check when create sharding table reference rule
    
    * optimize code
---
 .../update/CreateShardingTableReferenceRuleStatementUpdater.java        | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableReferenceRuleStatementUpdater.java b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableReferenceRuleStatementUpdater.java
index 94b871fc8ff..65d21ca48e7 100644
--- a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableReferenceRuleStatementUpdater.java
+++ b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableReferenceRuleStatementUpdater.java
@@ -25,6 +25,7 @@ import org.apache.shardingsphere.infra.util.exception.ShardingSpherePrecondition
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
 import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
 import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.distsql.handler.checker.ShardingTableRuleStatementChecker;
 import org.apache.shardingsphere.sharding.distsql.parser.segment.TableReferenceRuleSegment;
 import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingTableReferenceRuleStatement;
 
@@ -45,6 +46,7 @@ public final class CreateShardingTableReferenceRuleStatementUpdater implements R
         checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
         checkToBeCreatedBindingTables(databaseName, sqlStatement, currentRuleConfig);
         checkToBeCreatedDuplicateBindingTables(databaseName, sqlStatement, currentRuleConfig);
+        ShardingTableRuleStatementChecker.checkBindingTableConfiguration(buildToBeCreatedRuleConfiguration(sqlStatement).getBindingTableGroups(), currentRuleConfig);
     }
     
     private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws MissingRequiredRuleException {