StarHuzy commented on issue #16725: URL: https://github.com/apache/shardingsphere/issues/16725#issuecomment-1752304910
> There is also some experiment in ShardingSphere 4.x to implement `SPI` in the registry to dynamically modify `actualDatanodes`, this process becomes more complex in `5.x` as the data distribution changes and the `ShardingRule` is rebuilt, I wonder if anyone's willing to do that. If you dispense with `ShardingSphere` data sources altogether, you can use its algorithm classes to encapsulate util yourself, bypassing the problems `actualDatanodes` needs to find. hello , i Use custom table splitting strategy ,Successfully dynamically adding nodes There will be no issues in the SQL execution of a single tables,But if there are node configuration issues in cascading queries with `join query`  ``` @Component @Slf4j public class DataShardingAlgorithm implements StandardShardingAlgorithm<Long> { @Override public Collection<String> doSharding(Collection<String> collection, RangeShardingValue<Long> rangeShardingValue) { System.out.println("demo = " + collection); return collection; } @Override public String doSharding(Collection<String> collection, PreciseShardingValue<Long> preciseShardingValue) { StringBuilder resultTableName = new StringBuilder(); String logicTableName = preciseShardingValue.getLogicTableName(); // 拼接的tenantId,格式为 表名_{tenant_id} resultTableName.append(logicTableName).append("_").append(preciseShardingValue.getValue()); String newTableName = resultTableName.toString().toLowerCase(); if (!collection.contains(newTableName)) { // 动态新增节点 ShardingAlgorithmTool.copyTable(logicTableName,newTableName); collection.add(newTableName); } System.out.println("collection = " + collection); return newTableName; } @Override public String getType() { return null; } @Override public void init(Properties properties) { } } ``` -- 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]
