Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There was a problem upgrading the version 4.1.1 ~5.x #17146

Closed
asdxiaoqex opened this issue Apr 27, 2022 · 6 comments
Closed

There was a problem upgrading the version 4.1.1 ~5.x #17146

asdxiaoqex opened this issue Apr 27, 2022 · 6 comments

Comments

@asdxiaoqex
Copy link

asdxiaoqex commented Apr 27, 2022

image

In the old version 4.x, I got the split table rule through datasource, and then modified it with reflection to achieve dynamic capacity expansion.

In the new version5.x, I can't find a place to get the sharingrule. I hope you can prompt where you can reference.
image

Or there are other APIs that can provide better dynamic capacity expansion table rules. Please give me some guidance.

@TeslaCN
Copy link
Member

TeslaCN commented Apr 27, 2022

Hi @asdxiaoqex
You may try getRuleMetaData().findRule(ShardingRule.class).

public <T extends ShardingSphereRule> Optional<T> findSingleRule(final Class<T> clazz) {
Collection<T> foundRules = findRules(clazz);
return foundRules.isEmpty() ? Optional.empty() : Optional.of(foundRules.iterator().next());
}

@asdxiaoqex
Copy link
Author

Hi @asdxiaoqex You may try getRuleMetaData().findRule(ShardingRule.class).

public <T extends ShardingSphereRule> Optional<T> findSingleRule(final Class<T> clazz) {
Collection<T> foundRules = findRules(clazz);
return foundRules.isEmpty() ? Optional.empty() : Optional.of(foundRules.iterator().next());
}

is empty

@asdxiaoqex
Copy link
Author

我是想获取到 表路由的配置 然后修改他

@asdxiaoqex
Copy link
Author

因为我现在是把一些由日期动态创建的路由 也加载进去 因为每天都会 新增新的路由表 旧版本可以通过上面那个shardingRule反射去改,新版 没找到

@github-actions
Copy link

github-actions bot commented Oct 8, 2022

Hello , this issue has not received a reply for several days.
This issue is supposed to be closed.

@RaigorJiang
Copy link
Contributor

@asdxiaoqex I think you can refer to #16725, and a better way is to execute DistSQL through Proxy for maintenance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants