You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "harmonyzhang (via GitHub)" <gi...@apache.org> on 2025/02/19 11:48:01 UTC

[I] Table t_email does not exist. [shardingsphere]

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

   @Bean(name = DEFAULT_DATASOURCE)
   public DataSource defaultDataSource() throws SQLException {
       ReadwriteSplittingDataSourceGroupRuleConfiguration dataSourceConfig = new ReadwriteSplittingDataSourceGroupRuleConfiguration("ds_0", "ds_0_0", Arrays.asList("ds_0_1", "ds_0_2"), "round_lb");
       ReadwriteSplittingDataSourceGroupRuleConfiguration dataSourceConfig1 = new ReadwriteSplittingDataSourceGroupRuleConfiguration("ds_1", "ds_1_0", Arrays.asList("ds_1_1", "ds_1_2"), "round_lb");
       // 使用轮询负载均衡算法         
       Map<String, AlgorithmConfiguration> algorithmConfigMap = new HashMap<>(1);
       algorithmConfigMap.put("round_lb", new AlgorithmConfiguration("ROUND_ROBIN", new Properties()));
       ReadwriteSplittingRuleConfiguration ruleConfig = new ReadwriteSplittingRuleConfiguration(Arrays.asList(dataSourceConfig, dataSourceConfig1), algorithmConfigMap);
       Properties props = new Properties();
       props.setProperty("sql-show", Boolean.TRUE.toString());
       Map<String, DataSource> dataSourceMap = createDataSourceMap();
       
       return ShardingSphereDataSourceFactory.createDataSource(dataSourceMap, Arrays.asList(ruleConfig, createShardingRuleConfiguration()), props);
   }
   
   // 分片配置     
   private ShardingRuleConfiguration createShardingRuleConfiguration() throws SQLException {
       ShardingRuleConfiguration result = new ShardingRuleConfiguration();
       result.getTables().add(getTableRuleConfiguration("t_order"));
       result.setDefaultDatabaseShardingStrategy(new StandardShardingStrategyConfiguration("company_id", "geo-hash-algorithm"));
       result.setDefaultTableShardingStrategy(new StandardShardingStrategyConfiguration("company_id", "table-customize-algorithm"));
       Properties props = new Properties();
       props.setProperty("strategy", "standard");
       // 标准算法         
       props.setProperty("algorithmClassName", GeoHashShardingAlgorithm.class.getName());
       result.getShardingAlgorithms().put("geo-hash-algorithm", new AlgorithmConfiguration("CLASS_BASED", props));
       Properties props1 = new Properties();
       props1.setProperty("strategy", "standard");
       // 标准算法         
       props1.setProperty("algorithmClassName", TableCustomizeShardingAlgorithm.class.getName());
       result.getShardingAlgorithms().put("table-customize-algorithm", new AlgorithmConfiguration("CLASS_BASED", props1));
       return result;
   }
   
   private ShardingTableRuleConfiguration getTableRuleConfiguration(String tableName) {
       ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration(tableName, "ds_${0..1}." + tableName);
       return result;
   }
   
   private Map<String, DataSource> createDataSourceMap() {
       Map<String, DataSource> result = new HashMap<>(6, 1);
       result.put("ds_0_0", createDataSource(readwriteProperties()));
       result.put("ds_0_1", createDataSource(read1Properties()));
       result.put("ds_0_2", createDataSource(read2Properties()));
       result.put("ds_1_0", createDataSource(readwriteProperties()));
       result.put("ds_1_1", createDataSource(read1Properties()));
       result.put("ds_1_2", createDataSource(read2Properties()));
       return result;
   }
   
   version: 5.5.1
   
   Using the above configuration, the business error indicates that the table does not exist. It is found that tables without configured rules are all unavailable, and neither the custom database sharding algorithm nor the table sharding algorithm has been executed.
   
   


-- 
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] Table t_email does not exist. [shardingsphere]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #34724:
URL: https://github.com/apache/shardingsphere/issues/34724#issuecomment-2773919912

   There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.


-- 
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] Table t_email does not exist. [shardingsphere]

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

   What is your database type and metadata?


-- 
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] Table t_email does not exist. [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #34724: Table t_email does not exist.
URL: https://github.com/apache/shardingsphere/issues/34724


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