You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "geekerzhou (via GitHub)" <gi...@apache.org> on 2025/03/05 12:36:38 UTC

[I] 5.5.2 Same actual data node cannot be configured in multiple logic tables in same database [shardingsphere]

geekerzhou opened a new issue, #34889:
URL: https://github.com/apache/shardingsphere/issues/34889

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   
   5.5.2
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   jdbc
   
   ### Expected behavior
   
   - !SHARDING
       tables:
         order_main:
           actualDataNodes: ds$->{0..2}.order_main_$->{0..999}
           databaseStrategy:
             standard:
               shardingColumn: order_id
               shardingAlgorithmName: custom-database-algorithm
           tableStrategy:
             standard:
               shardingColumn: order_id
               shardingAlgorithmName: custom-order-id-algorithm
         order_main_hint:
           actualDataNodes: ds$->{0..2}.order_main_$->{0..999}
           databaseStrategy:
             hint:
               shardingAlgorithmName: custom-hint-algorithm
           tableStrategy:
             hint:
               shardingAlgorithmName: custom-hint-algorithm
   
   this config works fine in 5.2.1, upgrade to 5.5.2 throw exception
   
   ### Actual behavior
   
   Same actual data node cannot be configured in multiple logic tables in same database, logical table 'order_main_hint', actual data node 'ds0.order_main_0'.
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 5.5.2 Same actual data node cannot be configured in multiple logic tables in same database [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #34889:
URL: https://github.com/apache/shardingsphere/issues/34889#issuecomment-3642560451

   ##  Problem Understanding
   
     - In 5.5.2 (JDBC), two logical tables order_main and order_main_hint share the same actualDataNodes (ds$->{0..2}.order_main_$->{0..999}), and startup fails with “Same actual data node cannot be configured in multiple logic tables in same database…”. It worked in 5.2.1
       but is blocked after upgrade.
   
   ##  Root Cause
   
     - 5.5.2 introduces a pre-checker ShardingRuleChecker, which runs checkUniqueActualDataNodesInTableRules() (see features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/checker/ShardingRuleChecker.java). It requires the first actual data node of each
       logical table to be unique within the same database. Both logical tables start with ds0.order_main_0, so DuplicateShardingActualDataNodeException is raised. This is a stricter config validation change, not a runtime bug.
   
   ##  Analysis
   
     - ShardingSphere’s intended usage is “one physical table set belongs to one logical table.” Reusing the same physical tables across multiple logical tables creates ambiguity in metadata, binding-table checks, and routing/rewriting caches, so 5.5.2 rejects it during
       rule assembly.
     - Using a second logical table to switch to a Hint sharding strategy over the same physical tables conflicts with this constraint. The recommended approach is to keep a single logical table and use a custom sharding algorithm that routes based on Hint or column values,
       rather than creating another logical table name pointing to the same physical tables.
     - Relevant official docs (these describe config and algorithms, though not this specific restriction):
         - Sharding YAML config (tables and sharding strategies): https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding/#tables
         - Sharding strategies (standard/Hint): https://shardingsphere.apache.org/document/current/en/user-manual/common-config/builtin-algorithm/sharding/
   
   ##  Conclusion
   
     - This is a configuration tightening in 5.5.2 and the scenario is no longer supported; it is not a framework bug. Suggestions:
         - Keep a single logical table and implement routing inside your custom sharding algorithm using Hint or column values to achieve the desired behavior


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 5.5.2 Same actual data node cannot be configured in multiple logic tables in same database [shardingsphere]

Posted by "yjmyzz (via GitHub)" <gi...@apache.org>.
yjmyzz commented on issue #34889:
URL: https://github.com/apache/shardingsphere/issues/34889#issuecomment-2798877671

   同1个逻辑表,对应不同的实际表,在某些场景下是有用的。
   
   比如:逻辑表t_shop,对应一堆shop_0,... shop_n,其中某些数据量大的商家,单独到某个特定的分表,比如shop_1
   
   如果想快速查这些大商家的数据(又不知道id的情况下),可以单独映射1个新的逻辑表 big_shop -> shop_1
   
   需要查询的地方,直接查big_shop就可以了


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 5.5.2 Same actual data node cannot be configured in multiple logic tables in same database [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #34889: 5.5.2 Same actual data node cannot be configured in multiple logic tables in same database
URL: https://github.com/apache/shardingsphere/issues/34889


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 5.5.2 Same actual data node cannot be configured in multiple logic tables in same database [shardingsphere]

Posted by "suummer (via GitHub)" <gi...@apache.org>.
suummer commented on issue #34889:
URL: https://github.com/apache/shardingsphere/issues/34889#issuecomment-2712811805

   same


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org