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

   ## 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**.
   
   with ShardingSphere-JDBC 5.4.1, use java config
   
   my DataSource
   
   ```
       @Bean("originProject")
       public DataSource dataSourceProject() {
           HikariDataSource ds = new HikariDataSource();
           ConfigGroup configGroup = ZkConfigUtils.getConfig("mysql");
           String url = MapUtils.getString(configGroup, "db.project.url");
           ds.setJdbcUrl(url);
           logger.info("originProject:" + url);
           ds.setDriverClassName(MapUtils.getString(configGroup, 
"driverClassName"));
           ds.setUsername(MapUtils.getString(configGroup, "username"));
           ds.setPassword(MapUtils.getString(configGroup, "password"));
           ds.setMaximumPoolSize(500);
           ds.setMinimumIdle(16);
           ds.setConnectionTimeout(60000);
           return shardingDs("project", ds);
       }
   ```
   
   ShardingTableRuleConfiguration like this
   "db_project.tb_document_file_00${[0, 1]}");
   
   ```
       void factory(String schemaName, ShardingTable shardingTable) {
   //        result.setLogicTable(tableName);
   //        String act = "";
   //        if (getTableSize() < 256) {
   //            act = "db_" + schemaName + "." + tableName + "_00${0..1}";
   //        } else {
   //            act = "db_" + schemaName + "." + tableName + "_00${0..9}," + 
schemaName + "." + tableName + "_0${10..99}," + schemaName + "." + tableName + 
"_${100..255}";
   //        }
   //        logger.info("Sharding.factory:" + act);
   
   
           if (shardingTable.isSharding()) {
               ShardingTableRuleConfiguration result = new 
ShardingTableRuleConfiguration(shardingTable.getName(), "db_" + schemaName + 
"." + shardingTable.getName() + "_00${[0, 1]}");
               Properties properties = new Properties();
               properties.setProperty("algorithm-expression", 
shardingTable.getName() + "_00${organization_id % 2}");
               String shardingStrategyKey = "sharding_algorithm_" + 
shardingTable.getName();
               
shardingRuleConfig.getShardingAlgorithms().put(shardingStrategyKey, new 
AlgorithmConfiguration("INLINE", properties));
               shardingRuleConfig.getBindingTableGroups().add(new 
ShardingTableReferenceRuleConfiguration("db_" + schemaName, 
shardingTable.getName()));
               result.setTableShardingStrategy(new 
StandardShardingStrategyConfiguration("organization_id", shardingStrategyKey));
               shardingRuleConfig.getTables().add(result);
           } else {
               ShardingTableRuleConfiguration result = new 
ShardingTableRuleConfiguration(shardingTable.getName(), "db_" + schemaName + 
"." + shardingTable.getName() + "");
               Properties properties = new Properties();
               properties.setProperty("algorithm-expression", 
shardingTable.getName() + "");
               String shardingStrategyKey = "sharding_algorithm_" + 
shardingTable.getName();
               
shardingRuleConfig.getShardingAlgorithms().put(shardingStrategyKey, new 
AlgorithmConfiguration("INLINE", properties));
               shardingRuleConfig.getBindingTableGroups().add(new 
ShardingTableReferenceRuleConfiguration("db_" + schemaName, 
shardingTable.getName()));
               result.setTableShardingStrategy(new 
StandardShardingStrategyConfiguration("organization_id_xxx", 
shardingStrategyKey));
               shardingRuleConfig.getTables().add(result);
           }
           if (StringUtils.equals(schemaName, "uc")) {
               logger.info("noShard=" + shardingTable.getName());
           }
       }
   ```
   
   **Low probability randomness throw exception**
   
   Routed target `tb_document_book_000` does not exist, available targets are 
`[tb_document_file_000, tb_document_file_001]`
   
   but when i refresh view,  it`s will run success.
   
   
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   5.4.1
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   
   ### Actual behavior
   throw exception Routed target `tb_document_book_000` does not exist, 
available targets are `[tb_document_file_000, tb_document_file_001]`
   ### 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: 
[email protected]

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

Reply via email to