apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.88k stars 6.73k forks source link

actualDataNodes is wrong when ModShardingAlgorithm's zeroPadding is true #31053

Open Aresxue opened 5 months ago

Aresxue commented 5 months ago

Which version of ShardingSphere did you use?

5.4.1

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-JDBC

Expected behavior

When ModShardingAlgorithm is used and zeroPadding is true and the shards exceed 10, the first shard of table user should be user_00

Actual behavior

the first shard of table user be user_0

Reason analyze (If you can)

For the scenario where zeroPadding of ModShardingAlgorithm is true, org.apache.shardingsphere.infra.datanode.DataNodeUtils#getFormatDataNodes should be adjusted accordingly.

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).

csonezp commented 3 months ago

Can you provide the complete config file you used? I can't reproduce this problem now @Aresxue