terrymanu commented on issue #25095:
URL:
https://github.com/apache/shardingsphere/issues/25095#issuecomment-3637417557
## Problem Understanding:
In 5.3.1 JDBC mode, dss0 holds even tables, dss1 holds odd tables. The same
id column is used for both db and table sharding. Single-point queries work,
but WHERE id IN (...) routes to non-existent tables (e.g., dss1.demotable2),
causing “cannot
find demotable2.”
## Root Cause:
Standard sharding routes databases and tables separately and then combines
them. With multi-value IN, db sharding yields dss0 and dss1; table sharding
yields demotable_1/2/3/4. It then filters by each db’s actual-data-nodes. Your
actual-data-nodes (from the
SQL it seems you declared demotable_0~64 for both dss0 and dss1) do not
match the real topology, so the router believes dss1 has even tables and
generates calls to missing tables. ShardingSphere assumes homogenous topology
across shard databases; heterogeneous layouts
(some shards missing tables) cause this behavior. This is a usage/config
issue, not a product bug.
## Analysis:
- The shown snippet likely has db/table algorithm expressions swapped, but
even if fixed, declaring full actual-data-nodes will still make IN send even
tables to dss1.
- If you want odd/even split, actual-data-nodes must enumerate only the
real nodes (e.g.,
dss0.demotable_0,dss0.demotable_2,...,dss1.demotable_1,dss1.demotable_3,...),
or both databases must create the full set of tables to align with
ShardingSphere’s homogeneity
assumption.
- The “select * from dss1.demotable0~64 ...” happens because your rule
claims dss1 owns 0~64; the router follows the config and cannot detect missing
physical tables.
## Conclusion:
The behavior comes from config/topology diverging from ShardingSphere’s
homogenous-shard assumption, not a framework bug. Please adjust:
1. Make actual-data-nodes list only existing tables, or create the full
table set on each shard;
2. Ensure db/table sharding expressions are correct (db: dss${id % 2},
table: demotable_${id % 64}).
If it still fails, please share the full YAML actual-data-nodes, the
real table list on each db, and the complete error stack for further checking.
--
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]