You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/06/15 07:06:23 UTC
[GitHub] [shardingsphere] tuichenchuxin opened a new pull request, #18372: add actualDataNodes for auto tables.
tuichenchuxin opened a new pull request, #18372:
URL: https://github.com/apache/shardingsphere/pull/18372
For #18282 .
Changes proposed in this pull request:
support persist actual data node to zk for auto table.
--
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
[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #18372: add actualDataNodes for auto tables.
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #18372:
URL: https://github.com/apache/shardingsphere/pull/18372#discussion_r899936749
##########
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/TableRule.java:
##########
@@ -153,24 +152,15 @@ private DataNodeInfo createTableDataNode(final Collection<DataNode> actualDataNo
}
private List<String> getDataNodes(final ShardingAutoTableRuleConfiguration tableRuleConfig, final ShardingAutoTableAlgorithm shardingAlgorithm, final Collection<String> dataSourceNames) {
+ if (null != tableRuleConfig.getActualDataNodes() && !tableRuleConfig.getActualDataNodes().isEmpty()) {
+ return new InlineExpressionParser(tableRuleConfig.getActualDataNodes()).splitAndEvaluate();
+ }
if (null == tableShardingStrategyConfig) {
return new LinkedList<>();
}
List<String> dataSources = Strings.isNullOrEmpty(tableRuleConfig.getActualDataSources()) ? new LinkedList<>(dataSourceNames)
: new InlineExpressionParser(tableRuleConfig.getActualDataSources()).splitAndEvaluate();
- return fillDataSourceNames(shardingAlgorithm.getAutoTablesAmount(), dataSources);
- }
-
- private List<String> fillDataSourceNames(final int amount, final List<String> dataSources) {
- List<String> result = new LinkedList<>();
- Iterator<String> iterator = dataSources.iterator();
- for (int i = 0; i < amount; i++) {
- if (!iterator.hasNext()) {
- iterator = dataSources.iterator();
- }
- result.add(String.format("%s.%s_%s", iterator.next(), logicTable, i));
- }
- return result;
+ return DataNodeUtil.getFormatDataNodeList(shardingAlgorithm.getAutoTablesAmount(), logicTable, dataSources);
Review Comment:
Do you think rename getFormatDataNodeList to getFormatDataNodes is better?
--
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
[GitHub] [shardingsphere] codecov-commenter commented on pull request #18372: add actualDataNodes for auto tables.
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #18372:
URL: https://github.com/apache/shardingsphere/pull/18372#issuecomment-1158565715
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/18372?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#18372](https://codecov.io/gh/apache/shardingsphere/pull/18372?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b8d1a71) into [master](https://codecov.io/gh/apache/shardingsphere/commit/4175bfeb3a0e848a5e24b0645c703ddd17e87f4e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4175bfe) will **decrease** coverage by `0.01%`.
> The diff coverage is `37.50%`.
```diff
@@ Coverage Diff @@
## master #18372 +/- ##
============================================
- Coverage 59.09% 59.07% -0.02%
+ Complexity 2259 2256 -3
============================================
Files 3726 3726
Lines 54867 54890 +23
Branches 8014 8019 +5
============================================
+ Hits 32421 32425 +4
- Misses 19682 19694 +12
- Partials 2764 2771 +7
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/18372?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...onfig/rule/ShardingAutoTableRuleConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/18372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFyZGluZy9hcGkvY29uZmlnL3J1bGUvU2hhcmRpbmdBdXRvVGFibGVSdWxlQ29uZmlndXJhdGlvbi5qYXZh) | `0.00% <ø> (ø)` | |
| [...g/rule/YamlShardingAutoTableRuleConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/18372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcveWFtbC9jb25maWcvcnVsZS9ZYW1sU2hhcmRpbmdBdXRvVGFibGVSdWxlQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <ø> (ø)` | |
| [...RuleAlgorithmProviderConfigurationYamlSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/18372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcveWFtbC9zd2FwcGVyL1NoYXJkaW5nUnVsZUFsZ29yaXRobVByb3ZpZGVyQ29uZmlndXJhdGlvbllhbWxTd2FwcGVyLmphdmE=) | `9.80% <0.00%> (-1.97%)` | :arrow_down: |
| [...he/shardingsphere/infra/datanode/DataNodeUtil.java](https://codecov.io/gh/apache/shardingsphere/pull/18372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9kYXRhbm9kZS9EYXRhTm9kZVV0aWwuamF2YQ==) | `68.18% <0.00%> (-31.82%)` | :arrow_down: |
| [...apache/shardingsphere/sharding/rule/TableRule.java](https://codecov.io/gh/apache/shardingsphere/pull/18372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcnVsZS9UYWJsZVJ1bGUuamF2YQ==) | `81.90% <33.33%> (-2.65%)` | :arrow_down: |
| [.../swapper/ShardingRuleConfigurationYamlSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/18372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcveWFtbC9zd2FwcGVyL1NoYXJkaW5nUnVsZUNvbmZpZ3VyYXRpb25ZYW1sU3dhcHBlci5qYXZh) | `78.78% <33.33%> (-1.52%)` | :arrow_down: |
| [...ShardingAutoTableRuleConfigurationYamlSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/18372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcveWFtbC9zd2FwcGVyL3J1bGUvU2hhcmRpbmdBdXRvVGFibGVSdWxlQ29uZmlndXJhdGlvbllhbWxTd2FwcGVyLmphdmE=) | `56.09% <54.16%> (-8.91%)` | :arrow_down: |
| [...d/text/distsql/ral/common/hint/HintSourceType.java](https://codecov.io/gh/apache/shardingsphere/pull/18372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL2NvbW1vbi9oaW50L0hpbnRTb3VyY2VUeXBlLmphdmE=) | `42.85% <0.00%> (+42.85%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/18372?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/18372?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4175bfe...b8d1a71](https://codecov.io/gh/apache/shardingsphere/pull/18372?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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
[GitHub] [shardingsphere] strongduanmu merged pull request #18372: add actualDataNodes for auto tables.
Posted by GitBox <gi...@apache.org>.
strongduanmu merged PR #18372:
URL: https://github.com/apache/shardingsphere/pull/18372
--
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
[GitHub] [shardingsphere] tuichenchuxin commented on a diff in pull request #18372: add actualDataNodes for auto tables.
Posted by GitBox <gi...@apache.org>.
tuichenchuxin commented on code in PR #18372:
URL: https://github.com/apache/shardingsphere/pull/18372#discussion_r899953266
##########
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/TableRule.java:
##########
@@ -153,24 +152,15 @@ private DataNodeInfo createTableDataNode(final Collection<DataNode> actualDataNo
}
private List<String> getDataNodes(final ShardingAutoTableRuleConfiguration tableRuleConfig, final ShardingAutoTableAlgorithm shardingAlgorithm, final Collection<String> dataSourceNames) {
+ if (null != tableRuleConfig.getActualDataNodes() && !tableRuleConfig.getActualDataNodes().isEmpty()) {
+ return new InlineExpressionParser(tableRuleConfig.getActualDataNodes()).splitAndEvaluate();
+ }
if (null == tableShardingStrategyConfig) {
return new LinkedList<>();
}
List<String> dataSources = Strings.isNullOrEmpty(tableRuleConfig.getActualDataSources()) ? new LinkedList<>(dataSourceNames)
: new InlineExpressionParser(tableRuleConfig.getActualDataSources()).splitAndEvaluate();
- return fillDataSourceNames(shardingAlgorithm.getAutoTablesAmount(), dataSources);
- }
-
- private List<String> fillDataSourceNames(final int amount, final List<String> dataSources) {
- List<String> result = new LinkedList<>();
- Iterator<String> iterator = dataSources.iterator();
- for (int i = 0; i < amount; i++) {
- if (!iterator.hasNext()) {
- iterator = dataSources.iterator();
- }
- result.add(String.format("%s.%s_%s", iterator.next(), logicTable, i));
- }
- return result;
+ return DataNodeUtil.getFormatDataNodeList(shardingAlgorithm.getAutoTablesAmount(), logicTable, dataSources);
Review Comment:
OK, Thank you. Done.
--
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