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/01/25 02:31:13 UTC

[GitHub] [shardingsphere] lanchengx opened a new pull request #15036: [DistSQL]`show instance list` syntax add the display of labels.

lanchengx opened a new pull request #15036:
URL: https://github.com/apache/shardingsphere/pull/15036


   For https://github.com/apache/shardingsphere/issues/15018
   
   Changes proposed in this pull request:
   - `show instance list` syntax add the display of labels.
   
   ![image](https://user-images.githubusercontent.com/52209337/150899359-080358d7-6fd7-4248-9a97-e657a44b1f1f.png)
   


-- 
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 #15036: [DistSQL]`show instance list` syntax add the display of labels.

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


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15036?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 [#15036](https://codecov.io/gh/apache/shardingsphere/pull/15036?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (21fc478) into [master](https://codecov.io/gh/apache/shardingsphere/commit/e85221cbc4fe10329c0eb3119c0a632f34252a36?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e85221c) will **decrease** coverage by `0.00%`.
   > The diff coverage is `0.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/15036/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/15036?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   #15036      +/-   ##
   ============================================
   - Coverage     59.64%   59.64%   -0.01%     
     Complexity     1896     1896              
   ============================================
     Files          3147     3147              
     Lines         46986    46988       +2     
     Branches       7975     7977       +2     
   ============================================
     Hits          28024    28024              
   - Misses        16735    16737       +2     
     Partials       2227     2227              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/15036?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ral/common/show/executor/ShowInstanceExecutor.java](https://codecov.io/gh/apache/shardingsphere/pull/15036/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL2NvbW1vbi9zaG93L2V4ZWN1dG9yL1Nob3dJbnN0YW5jZUV4ZWN1dG9yLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...he/shardingsphere/infra/metadata/user/Grantee.java](https://codecov.io/gh/apache/shardingsphere/pull/15036/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-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS91c2VyL0dyYW50ZWUuamF2YQ==) | `55.55% <0.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15036?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/15036?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 [e85221c...21fc478](https://codecov.io/gh/apache/shardingsphere/pull/15036?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] RaigorJiang commented on a change in pull request #15036: [DistSQL]`show instance list` syntax add the display of labels.

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



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowInstanceExecutor.java
##########
@@ -78,24 +80,26 @@ protected MergedResult createMergedResult() {
     private Collection<List<Object>> buildInstanceRows() {
         List<List<Object>> result = new LinkedList<>();
         InstanceId instanceId = ProxyContext.getInstance().getContextManager().getInstanceContext().getInstance().getInstanceDefinition().getInstanceId();
-        result.add(buildRow(instanceId.getId(), ENABLE));
+        result.add(buildRow(instanceId.getId(), ENABLE, Collections.emptyList()));
         return result;
     }
     
     private Collection<List<Object>> buildInstanceRows(final MetaDataPersistService persistService) {
         Collection<ComputeNodeInstance> instances = persistService.getComputeNodePersistService().loadAllComputeNodeInstances();
         if (!instances.isEmpty()) {
-            return instances.stream().filter(Objects::nonNull).map(each -> buildRow(each.getInstanceDefinition().getInstanceId().getId(), getStatus(each.getStatus())))
+            return instances.stream().filter(Objects::nonNull)
+                    .map(each -> buildRow(each.getInstanceDefinition().getInstanceId().getId(), getStatus(each.getStatus()), each.getLabels()))
                     .collect(Collectors.toCollection(LinkedList::new));
         }
         return Collections.emptyList();
     }
     
-    private List<Object> buildRow(final String instanceId, final String status) {
+    private List<Object> buildRow(final String instanceId, final String status, final Collection<String> labelCollection) {

Review comment:
       I think `labels` for the last param is better than `labelCollection`.




-- 
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] RaigorJiang merged pull request #15036: [DistSQL]`show instance list` syntax add the display of labels.

Posted by GitBox <gi...@apache.org>.
RaigorJiang merged pull request #15036:
URL: https://github.com/apache/shardingsphere/pull/15036


   


-- 
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 #15036: [DistSQL]`show instance list` syntax add the display of labels.

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


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15036?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 [#15036](https://codecov.io/gh/apache/shardingsphere/pull/15036?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (21fc478) into [master](https://codecov.io/gh/apache/shardingsphere/commit/e85221cbc4fe10329c0eb3119c0a632f34252a36?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e85221c) will **decrease** coverage by `0.00%`.
   > The diff coverage is `0.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/15036/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/15036?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   #15036      +/-   ##
   ============================================
   - Coverage     59.64%   59.64%   -0.01%     
     Complexity     1896     1896              
   ============================================
     Files          3147     3147              
     Lines         46986    46988       +2     
     Branches       7975     7977       +2     
   ============================================
     Hits          28024    28024              
   - Misses        16735    16737       +2     
     Partials       2227     2227              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/15036?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ral/common/show/executor/ShowInstanceExecutor.java](https://codecov.io/gh/apache/shardingsphere/pull/15036/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL2NvbW1vbi9zaG93L2V4ZWN1dG9yL1Nob3dJbnN0YW5jZUV4ZWN1dG9yLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...he/shardingsphere/infra/metadata/user/Grantee.java](https://codecov.io/gh/apache/shardingsphere/pull/15036/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-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS91c2VyL0dyYW50ZWUuamF2YQ==) | `55.55% <0.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15036?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/15036?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 [e85221c...21fc478](https://codecov.io/gh/apache/shardingsphere/pull/15036?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] RaigorJiang commented on a change in pull request #15036: [DistSQL]`show instance list` syntax add the display of labels.

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



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowInstanceExecutor.java
##########
@@ -78,24 +80,26 @@ protected MergedResult createMergedResult() {
     private Collection<List<Object>> buildInstanceRows() {
         List<List<Object>> result = new LinkedList<>();
         InstanceId instanceId = ProxyContext.getInstance().getContextManager().getInstanceContext().getInstance().getInstanceDefinition().getInstanceId();
-        result.add(buildRow(instanceId.getId(), ENABLE));
+        result.add(buildRow(instanceId.getId(), ENABLE, Collections.emptyList()));
         return result;
     }
     
     private Collection<List<Object>> buildInstanceRows(final MetaDataPersistService persistService) {
         Collection<ComputeNodeInstance> instances = persistService.getComputeNodePersistService().loadAllComputeNodeInstances();
         if (!instances.isEmpty()) {
-            return instances.stream().filter(Objects::nonNull).map(each -> buildRow(each.getInstanceDefinition().getInstanceId().getId(), getStatus(each.getStatus())))
+            return instances.stream().filter(Objects::nonNull)
+                    .map(each -> buildRow(each.getInstanceDefinition().getInstanceId().getId(), getStatus(each.getStatus()), each.getLabels()))
                     .collect(Collectors.toCollection(LinkedList::new));
         }
         return Collections.emptyList();
     }
     
-    private List<Object> buildRow(final String instanceId, final String status) {
+    private List<Object> buildRow(final String instanceId, final String status, final Collection<String> labelCollection) {

Review comment:
       I think `labels` for the last param is better than `labelCollection`.

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowInstanceExecutor.java
##########
@@ -78,24 +80,26 @@ protected MergedResult createMergedResult() {
     private Collection<List<Object>> buildInstanceRows() {
         List<List<Object>> result = new LinkedList<>();
         InstanceId instanceId = ProxyContext.getInstance().getContextManager().getInstanceContext().getInstance().getInstanceDefinition().getInstanceId();
-        result.add(buildRow(instanceId.getId(), ENABLE));
+        result.add(buildRow(instanceId.getId(), ENABLE, Collections.emptyList()));
         return result;
     }
     
     private Collection<List<Object>> buildInstanceRows(final MetaDataPersistService persistService) {
         Collection<ComputeNodeInstance> instances = persistService.getComputeNodePersistService().loadAllComputeNodeInstances();
         if (!instances.isEmpty()) {
-            return instances.stream().filter(Objects::nonNull).map(each -> buildRow(each.getInstanceDefinition().getInstanceId().getId(), getStatus(each.getStatus())))
+            return instances.stream().filter(Objects::nonNull)
+                    .map(each -> buildRow(each.getInstanceDefinition().getInstanceId().getId(), getStatus(each.getStatus()), each.getLabels()))
                     .collect(Collectors.toCollection(LinkedList::new));
         }
         return Collections.emptyList();
     }
     
-    private List<Object> buildRow(final String instanceId, final String status) {
+    private List<Object> buildRow(final String instanceId, final String status, final Collection<String> labelCollection) {
         String[] splitInstanceId = instanceId.split(DELIMITER);
         String host = splitInstanceId[0];
         String port = splitInstanceId.length < 2 ? "" : splitInstanceId[1];
-        return Stream.of(instanceId, host, port, status).map(each -> (Object) each).collect(Collectors.toCollection(LinkedList::new));
+        String labels = null == labelCollection ? "" : String.join(",", labelCollection);

Review comment:
       So this labels can be named `labelString`?




-- 
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] RaigorJiang commented on a change in pull request #15036: [DistSQL]`show instance list` syntax add the display of labels.

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



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowInstanceExecutor.java
##########
@@ -78,24 +80,26 @@ protected MergedResult createMergedResult() {
     private Collection<List<Object>> buildInstanceRows() {
         List<List<Object>> result = new LinkedList<>();
         InstanceId instanceId = ProxyContext.getInstance().getContextManager().getInstanceContext().getInstance().getInstanceDefinition().getInstanceId();
-        result.add(buildRow(instanceId.getId(), ENABLE));
+        result.add(buildRow(instanceId.getId(), ENABLE, Collections.emptyList()));
         return result;
     }
     
     private Collection<List<Object>> buildInstanceRows(final MetaDataPersistService persistService) {
         Collection<ComputeNodeInstance> instances = persistService.getComputeNodePersistService().loadAllComputeNodeInstances();
         if (!instances.isEmpty()) {
-            return instances.stream().filter(Objects::nonNull).map(each -> buildRow(each.getInstanceDefinition().getInstanceId().getId(), getStatus(each.getStatus())))
+            return instances.stream().filter(Objects::nonNull)
+                    .map(each -> buildRow(each.getInstanceDefinition().getInstanceId().getId(), getStatus(each.getStatus()), each.getLabels()))
                     .collect(Collectors.toCollection(LinkedList::new));
         }
         return Collections.emptyList();
     }
     
-    private List<Object> buildRow(final String instanceId, final String status) {
+    private List<Object> buildRow(final String instanceId, final String status, final Collection<String> labelCollection) {
         String[] splitInstanceId = instanceId.split(DELIMITER);
         String host = splitInstanceId[0];
         String port = splitInstanceId.length < 2 ? "" : splitInstanceId[1];
-        return Stream.of(instanceId, host, port, status).map(each -> (Object) each).collect(Collectors.toCollection(LinkedList::new));
+        String labels = null == labelCollection ? "" : String.join(",", labelCollection);

Review comment:
       So this labels can be named `labelString`?




-- 
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] RaigorJiang merged pull request #15036: [DistSQL]`show instance list` syntax add the display of labels.

Posted by GitBox <gi...@apache.org>.
RaigorJiang merged pull request #15036:
URL: https://github.com/apache/shardingsphere/pull/15036


   


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