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/09/12 12:41:04 UTC

[GitHub] [shardingsphere] dongzl opened a new pull request, #20938: Support audit declaration for create sharding table rule.

dongzl opened a new pull request, #20938:
URL: https://github.com/apache/shardingsphere/pull/20938

   Fixes #ISSUSE_ID.
   
   Changes proposed in this pull request:
     - Support audit declaration for create sharding table rule.
   


-- 
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 #20938: Support audit declaration for create sharding table rule.

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #20938:
URL: https://github.com/apache/shardingsphere/pull/20938#discussion_r972546512


##########
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java:
##########
@@ -351,6 +358,33 @@ public ASTNode visitKeyGenerateDefinition(final KeyGenerateDefinitionContext ctx
         return null == ctx ? null : new KeyGenerateStrategySegment(getIdentifierValue(ctx.columnName()), (AlgorithmSegment) visit(ctx.algorithmDefinition()));
     }
     
+    @Override
+    public ASTNode visitAuditStrategy(final AuditStrategyContext ctx) {
+        if (null == ctx) {
+            return null;
+        }
+        List<String> auditorNames = new ArrayList<>();

Review Comment:
   Can we use Collection and LinkedList here?



##########
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java:
##########
@@ -249,6 +254,24 @@ private static void checkKeyGenerators(final Collection<AbstractTableRuleSegment
         DistSQLException.predictionThrow(invalidKeyGenerators.isEmpty(), () -> new InvalidAlgorithmConfigurationException("key generator", invalidKeyGenerators));
     }
     
+    private static void checkAuditors(final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+        Set<String> notExistAuditors = new LinkedHashSet<>();
+        Set<String> requiredAuditors = new LinkedHashSet<>();
+        List<AuditStrategySegment> auditStrategySegments = rules.stream().map(AbstractTableRuleSegment::getAuditStrategySegment).filter(Objects::nonNull).collect(Collectors.toList());

Review Comment:
   Can we use Collection here?



##########
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java:
##########
@@ -249,6 +254,24 @@ private static void checkKeyGenerators(final Collection<AbstractTableRuleSegment
         DistSQLException.predictionThrow(invalidKeyGenerators.isEmpty(), () -> new InvalidAlgorithmConfigurationException("key generator", invalidKeyGenerators));
     }
     
+    private static void checkAuditors(final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+        Set<String> notExistAuditors = new LinkedHashSet<>();
+        Set<String> requiredAuditors = new LinkedHashSet<>();
+        List<AuditStrategySegment> auditStrategySegments = rules.stream().map(AbstractTableRuleSegment::getAuditStrategySegment).filter(Objects::nonNull).collect(Collectors.toList());
+        List<String> auditorNames = new ArrayList<>();

Review Comment:
   Use `new LinkedList<>()` may be 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 #20938: Support audit declaration for create sharding table rule.

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

   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/20938?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 [#20938](https://codecov.io/gh/apache/shardingsphere/pull/20938?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9a0567d) into [master](https://codecov.io/gh/apache/shardingsphere/commit/1071f48e6654c5cfafca4e1d34b21c5bd8331ebe?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1071f48) will **decrease** coverage by `0.00%`.
   > The diff coverage is `53.73%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #20938      +/-   ##
   ============================================
   - Coverage     61.80%   61.80%   -0.01%     
   - Complexity     2468     2476       +8     
   ============================================
     Files          4041     4042       +1     
     Lines         55486    55552      +66     
     Branches       9403     9414      +11     
   ============================================
   + Hits          34294    34333      +39     
   - Misses        18319    18341      +22     
   - Partials       2873     2878       +5     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/20938?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...l/parser/core/ShardingDistSQLStatementVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/20938/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1zaGFyZGluZy1kaXN0c3FsLXBhcnNlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvZGlzdHNxbC9wYXJzZXIvY29yZS9TaGFyZGluZ0Rpc3RTUUxTdGF0ZW1lbnRWaXNpdG9yLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...g/distsql/parser/segment/AuditStrategySegment.java](https://codecov.io/gh/apache/shardingsphere/pull/20938/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1zaGFyZGluZy1kaXN0c3FsLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvZGlzdHNxbC9wYXJzZXIvc2VnbWVudC9BdWRpdFN0cmF0ZWd5U2VnbWVudC5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...g/distsql/parser/segment/AutoTableRuleSegment.java](https://codecov.io/gh/apache/shardingsphere/pull/20938/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1zaGFyZGluZy1kaXN0c3FsLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvZGlzdHNxbC9wYXJzZXIvc2VnbWVudC9BdXRvVGFibGVSdWxlU2VnbWVudC5qYXZh) | `0.00% <ø> (ø)` | |
   | [...handler/query/ShardingTableRuleQueryResultSet.java](https://codecov.io/gh/apache/shardingsphere/pull/20938/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1zaGFyZGluZy1kaXN0c3FsLWhhbmRsZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYXJkaW5nL2Rpc3RzcWwvaGFuZGxlci9xdWVyeS9TaGFyZGluZ1RhYmxlUnVsZVF1ZXJ5UmVzdWx0U2V0LmphdmE=) | `48.19% <44.44%> (-0.46%)` | :arrow_down: |
   | [...ler/checker/ShardingTableRuleStatementChecker.java](https://codecov.io/gh/apache/shardingsphere/pull/20938/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1zaGFyZGluZy1kaXN0c3FsLWhhbmRsZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYXJkaW5nL2Rpc3RzcWwvaGFuZGxlci9jaGVja2VyL1NoYXJkaW5nVGFibGVSdWxlU3RhdGVtZW50Q2hlY2tlci5qYXZh) | `84.73% <88.88%> (+0.32%)` | :arrow_up: |
   | [...converter/ShardingTableRuleStatementConverter.java](https://codecov.io/gh/apache/shardingsphere/pull/20938/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1zaGFyZGluZy1kaXN0c3FsLWhhbmRsZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYXJkaW5nL2Rpc3RzcWwvaGFuZGxlci9jb252ZXJ0ZXIvU2hhcmRpbmdUYWJsZVJ1bGVTdGF0ZW1lbnRDb252ZXJ0ZXIuamF2YQ==) | `96.00% <100.00%> (+0.91%)` | :arrow_up: |
   | [...update/AlterShardingTableRuleStatementUpdater.java](https://codecov.io/gh/apache/shardingsphere/pull/20938/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1zaGFyZGluZy1kaXN0c3FsLWhhbmRsZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYXJkaW5nL2Rpc3RzcWwvaGFuZGxlci91cGRhdGUvQWx0ZXJTaGFyZGluZ1RhYmxlUnVsZVN0YXRlbWVudFVwZGF0ZXIuamF2YQ==) | `88.00% <100.00%> (+0.50%)` | :arrow_up: |
   | [...pdate/CreateShardingTableRuleStatementUpdater.java](https://codecov.io/gh/apache/shardingsphere/pull/20938/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1zaGFyZGluZy1kaXN0c3FsLWhhbmRsZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYXJkaW5nL2Rpc3RzcWwvaGFuZGxlci91cGRhdGUvQ3JlYXRlU2hhcmRpbmdUYWJsZVJ1bGVTdGF0ZW1lbnRVcGRhdGVyLmphdmE=) | `83.33% <100.00%> (+1.51%)` | :arrow_up: |
   | [...handler/distsql/ral/hint/enums/HintSourceType.java](https://codecov.io/gh/apache/shardingsphere/pull/20938/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9oYW5kbGVyL2Rpc3RzcWwvcmFsL2hpbnQvZW51bXMvSGludFNvdXJjZVR5cGUuamF2YQ==) | `42.85% <0.00%> (+42.85%)` | :arrow_up: |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?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 #20938: Support audit declaration for create sharding table rule.

Posted by GitBox <gi...@apache.org>.
strongduanmu merged PR #20938:
URL: https://github.com/apache/shardingsphere/pull/20938


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