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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to