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 2021/12/27 11:31:42 UTC

[GitHub] [shardingsphere] NOLouser opened a new pull request #14353: Load the meta data of all associated logical tables via actual table …

NOLouser opened a new pull request #14353:
URL: https://github.com/apache/shardingsphere/pull/14353


   Fixes #14273.
   
   Changes proposed in this pull request:
   - load the meta data of all associated logical tables via actual table name
   


-- 
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 change in pull request #14353: Load the meta data of all associated logical tables via actual table …

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #14353:
URL: https://github.com/apache/shardingsphere/pull/14353#discussion_r775868905



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
##########
@@ -521,6 +521,16 @@ public DataNode getDataNode(final String logicTableName) {
         findBindingTableRule(logicTable).ifPresent(bindingTableRule -> result.putAll(bindingTableRule.getLogicAndActualTables(dataSourceName, logicTable, actualTable, availableLogicBindingTables)));
         return result;
     }
+
+    /**
+     * Get logic tables via actual table name.
+     *
+     * @param actualTable actual table name
+     * @return logic tables
+     */
+    public List<String> getLogicTablesByActualTable(final String actualTable) {

Review comment:
       > 
   
   @NOLouser Take it easy and arrange it according to your time.




-- 
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] NOLouser commented on a change in pull request #14353: Load the meta data of all associated logical tables via actual table …

Posted by GitBox <gi...@apache.org>.
NOLouser commented on a change in pull request #14353:
URL: https://github.com/apache/shardingsphere/pull/14353#discussion_r775682195



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
##########
@@ -521,6 +521,16 @@ public DataNode getDataNode(final String logicTableName) {
         findBindingTableRule(logicTable).ifPresent(bindingTableRule -> result.putAll(bindingTableRule.getLogicAndActualTables(dataSourceName, logicTable, actualTable, availableLogicBindingTables)));
         return result;
     }
+
+    /**
+     * Get logic tables via actual table name.
+     *
+     * @param actualTable actual table name
+     * @return logic tables
+     */
+    public List<String> getLogicTablesByActualTable(final String actualTable) {

Review comment:
       Yeah,I will replace it in the next submission.




-- 
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] NOLouser closed pull request #14353: Load the meta data of all associated logical tables via actual table …

Posted by GitBox <gi...@apache.org>.
NOLouser closed pull request #14353:
URL: https://github.com/apache/shardingsphere/pull/14353


   


-- 
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 #14353: Load the meta data of all associated logical tables via actual table …

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #14353:
URL: https://github.com/apache/shardingsphere/pull/14353#issuecomment-1002031835


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/14353?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 [#14353](https://codecov.io/gh/apache/shardingsphere/pull/14353?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5aedeab) into [master](https://codecov.io/gh/apache/shardingsphere/commit/f2151421374e3e5a856f82a7283de4d3bb0ad154?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f215142) will **decrease** coverage by `0.16%`.
   > The diff coverage is `29.60%`.
   
   > :exclamation: Current head 5aedeab differs from pull request most recent head 0abf464. Consider uploading reports for the commit 0abf464 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/14353/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/14353?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #14353      +/-   ##
   ============================================
   - Coverage     59.80%   59.64%   -0.17%     
   - Complexity     1783     1792       +9     
   ============================================
     Files          2940     2949       +9     
     Lines         43704    43817     +113     
     Branches       7399     7432      +33     
   ============================================
   - Hits          26137    26133       -4     
   - Misses        15547    15660     +113     
   - Partials       2020     2024       +4     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/14353?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ser/core/common/CommonDistSQLStatementVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/14353/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-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1kaXN0c3FsLXBhcnNlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZGlzdHNxbC9wYXJzZXIvY29yZS9jb21tb24vQ29tbW9uRGlzdFNRTFN0YXRlbWVudFZpc2l0b3IuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ere/shadow/api/config/ShadowRuleConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/14353/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYWRvdy9hcGkvY29uZmlnL1NoYWRvd1J1bGVDb25maWd1cmF0aW9uLmphdmE=) | `0.00% <ø> (ø)` | |
   | [...nfig/AlgorithmProvidedShadowRuleConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/14353/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvYWxnb3JpdGhtL2NvbmZpZy9BbGdvcml0aG1Qcm92aWRlZFNoYWRvd1J1bGVDb25maWd1cmF0aW9uLmphdmE=) | `100.00% <ø> (ø)` | |
   | [...e/shardingsphere/shadow/route/ShadowSQLRouter.java](https://codecov.io/gh/apache/shardingsphere/pull/14353/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcm91dGUvU2hhZG93U1FMUm91dGVyLmphdmE=) | `17.39% <0.00%> (-53.45%)` | :arrow_down: |
   | [...hadow/yaml/config/YamlShadowRuleConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/14353/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cveWFtbC9jb25maWcvWWFtbFNoYWRvd1J1bGVDb25maWd1cmF0aW9uLmphdmE=) | `100.00% <ø> (ø)` | |
   | [...RuleAlgorithmProviderConfigurationYamlSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/14353/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cveWFtbC9zd2FwcGVyL1NoYWRvd1J1bGVBbGdvcml0aG1Qcm92aWRlckNvbmZpZ3VyYXRpb25ZYW1sU3dhcHBlci5qYXZh) | `92.85% <ø> (-0.48%)` | :arrow_down: |
   | [...ml/swapper/ShadowRuleConfigurationYamlSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/14353/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cveWFtbC9zd2FwcGVyL1NoYWRvd1J1bGVDb25maWd1cmF0aW9uWWFtbFN3YXBwZXIuamF2YQ==) | `16.12% <ø> (-77.82%)` | :arrow_down: |
   | [...sql/parser/core/ShadowDistSQLStatementVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/14353/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1kaXN0c3FsL3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1kaXN0c3FsLXBhcnNlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhZG93L2Rpc3RzcWwvcGFyc2VyL2NvcmUvU2hhZG93RGlzdFNRTFN0YXRlbWVudFZpc2l0b3IuamF2YQ==) | `0.00% <ø> (ø)` | |
   | [...mespace/parser/ShadowRuleBeanDefinitionParser.java](https://codecov.io/gh/apache/shardingsphere/pull/14353/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1zcHJpbmcvc2hhcmRpbmdzcGhlcmUtc2hhZG93LXNwcmluZy1uYW1lc3BhY2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYWRvdy9zcHJpbmcvbmFtZXNwYWNlL3BhcnNlci9TaGFkb3dSdWxlQmVhbkRlZmluaXRpb25QYXJzZXIuamF2YQ==) | `100.00% <ø> (ø)` | |
   | [...erator/impl/AggregationDistinctTokenGenerator.java](https://codecov.io/gh/apache/shardingsphere/pull/14353/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcmV3cml0ZS90b2tlbi9nZW5lcmF0b3IvaW1wbC9BZ2dyZWdhdGlvbkRpc3RpbmN0VG9rZW5HZW5lcmF0b3IuamF2YQ==) | `100.00% <ø> (ø)` | |
   | ... and [53 more](https://codecov.io/gh/apache/shardingsphere/pull/14353/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/14353?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/14353?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 [f215142...0abf464](https://codecov.io/gh/apache/shardingsphere/pull/14353?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 commented on a change in pull request #14353: Load the meta data of all associated logical tables via actual table …

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #14353:
URL: https://github.com/apache/shardingsphere/pull/14353#discussion_r775814620



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/metadata/ShardingTableMetaDataBuilder.java
##########
@@ -86,7 +88,12 @@ private void checkTableMetaData(final Collection<TableMetaData> tableMetaDataLis
     private Map<String, TableMetaData> getTableMetaDataMap(final Collection<TableMetaData> tableMetaDataList, final ShardingRule rule) {
         Map<String, TableMetaData> result = new LinkedHashMap<>();
         for (TableMetaData each : tableMetaDataList) {
-            result.putIfAbsent(rule.findLogicTableByActualTable(each.getName()).orElse(each.getName()), each);
+            List<String> logicTables = rule.getLogicTablesByActualTable(each.getName());
+            if (CollectionUtils.isEmpty(logicTables)) {

Review comment:
       @NOLouser Maybe `!logicTables.isEmpty()` is better.

##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
##########
@@ -521,6 +521,16 @@ public DataNode getDataNode(final String logicTableName) {
         findBindingTableRule(logicTable).ifPresent(bindingTableRule -> result.putAll(bindingTableRule.getLogicAndActualTables(dataSourceName, logicTable, actualTable, availableLogicBindingTables)));
         return result;
     }
+
+    /**
+     * Get logic tables via actual table name.
+     *
+     * @param actualTable actual table name
+     * @return logic tables
+     */
+    public List<String> getLogicTablesByActualTable(final String actualTable) {

Review comment:
       Hi @NOLouser, please modify the return type to collection, and add unit test for this method.

##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/metadata/ShardingTableMetaDataBuilder.java
##########
@@ -86,7 +88,12 @@ private void checkTableMetaData(final Collection<TableMetaData> tableMetaDataLis
     private Map<String, TableMetaData> getTableMetaDataMap(final Collection<TableMetaData> tableMetaDataList, final ShardingRule rule) {
         Map<String, TableMetaData> result = new LinkedHashMap<>();
         for (TableMetaData each : tableMetaDataList) {
-            result.putIfAbsent(rule.findLogicTableByActualTable(each.getName()).orElse(each.getName()), each);
+            List<String> logicTables = rule.getLogicTablesByActualTable(each.getName());

Review comment:
       @NOLouser Please use collection here.




-- 
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] NOLouser commented on a change in pull request #14353: Load the meta data of all associated logical tables via actual table …

Posted by GitBox <gi...@apache.org>.
NOLouser commented on a change in pull request #14353:
URL: https://github.com/apache/shardingsphere/pull/14353#discussion_r775865949



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
##########
@@ -521,6 +521,16 @@ public DataNode getDataNode(final String logicTableName) {
         findBindingTableRule(logicTable).ifPresent(bindingTableRule -> result.putAll(bindingTableRule.getLogicAndActualTables(dataSourceName, logicTable, actualTable, availableLogicBindingTables)));
         return result;
     }
+
+    /**
+     * Get logic tables via actual table name.
+     *
+     * @param actualTable actual table name
+     * @return logic tables
+     */
+    public List<String> getLogicTablesByActualTable(final String actualTable) {

Review comment:
       @strongduanmu 
   Sorry for the late reply, I will improve these later.




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