You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "carlvine500 (via GitHub)" <gi...@apache.org> on 2023/07/05 07:21:01 UTC

[GitHub] [dubbo] carlvine500 opened a new pull request, #12673: tag support multi level

carlvine500 opened a new pull request, #12673:
URL: https://github.com/apache/dubbo/pull/12673

   ## What is the purpose of the change
   fix issue #12672
   
   
   ## Brief changelog
   tag with multi level will search tag as following: 
   requestTag=beta|team1|partner1
   step0: if force=true , just search tag(beta|team1|partner1)
   step1:  search invokers with tag(beta|team1|partner1) , if result is empty , run step2
   step2: search invokers with tag(beta|team1), if result is empty , run step3
   step3: search invokers with tag(beta)
   
   ----
   there are 10 deploy with tag=null and 10 deploy with dubbo.tag=beta, but my team just work with 8 deploy for a big feature-A , and my partners just work with 3 deploy for a small feature-A-1 :
   
   my team want deploy 8 deploy with tag=beta|team1 , and share the deploy(tag=beta)
   my partners want deploy 3 deploy with tag=beta|team1|partner1 , and share the deploy(tag=beta|team1)
   
   ## Verifying this change
   
   
   <!-- Follow this checklist to help us incorporate your contribution quickly and easily: -->
   
   ## Checklist
   - [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
   - [ ] Each commit in the pull request should have a meaningful subject line and body.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
   - [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project.
   - [ ] Add some description to [dubbo-website](https://github.com/apache/dubbo-website) project if you are requesting to add a feature.
   - [ ] GitHub Actions works fine on your own branch.
   - [ ] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
   


-- 
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@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] carlvine500 commented on a diff in pull request #12673: tag support multi level

Posted by "carlvine500 (via GitHub)" <gi...@apache.org>.
carlvine500 commented on code in PR #12673:
URL: https://github.com/apache/dubbo/pull/12673#discussion_r1300833835


##########
dubbo-dependencies-bom/pom.xml:
##########
@@ -96,7 +96,7 @@
         <javassist_version>3.29.2-GA</javassist_version>
         <bytebuddy.version>1.14.5</bytebuddy.version>
         <netty_version>3.2.10.Final</netty_version>
-        <netty4_version>4.1.92.Final</netty4_version>
+        <netty4_version>4.1.94.Final</netty4_version>

Review Comment:
   > Why change the version?
   
   a issue upgrade it  , https://github.com/apache/dubbo/pull/12653
   
   4.1.92.Final has vulnerability ,  CVE-2023-34462. Severity: MEDIUM
   refer : https://mvnrepository.com/artifact/io.netty/netty-handler
   
   



-- 
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@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] chickenlj commented on pull request #12673: tag support multi level

Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj commented on PR #12673:
URL: https://github.com/apache/dubbo/pull/12673#issuecomment-1635472989

   @carlvine500 Please update the following documentation accordingly:
   
   https://cn.dubbo.apache.org/zh-cn/overview/core-features/traffic/#%E6%A0%87%E7%AD%BE%E8%B7%AF%E7%94%B1%E8%A7%84%E5%88%99
   
   https://cn.dubbo.apache.org/zh-cn/overview/core-features/traffic/tag-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@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] carlvine500 commented on a diff in pull request #12673: tag support multi level

Posted by "carlvine500 (via GitHub)" <gi...@apache.org>.
carlvine500 commented on code in PR #12673:
URL: https://github.com/apache/dubbo/pull/12673#discussion_r1300835452


##########
dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouter.java:
##########
@@ -306,4 +309,35 @@ public void stop() {
     public void setTagRouterRule(TagRouterRule tagRouterRule) {
         this.tagRouterRule = tagRouterRule;
     }
+
+    /**
+     * select addresses by tag with level
+     * <p>
+     * example:
+     * selector=beta|team1|partner1
+     * step1.select tagAddresses with selector=beta|team1|partner1, if result is empty, then run step2
+     * step2.select tagAddresses with selector=beta|team1, if result is empty, then run step3
+     * step3.select tagAddresses with selector=beta, if result is empty, result is null
+     * </p>
+     *
+     * @param tagAddresses
+     * @param tagSelector  eg: beta|team1|partner1
+     * @return
+     */
+    public static Set<String> selectAddressByTagLevel(Map<String, Set<String>> tagAddresses, String tagSelector, boolean isForce) {
+        if (isForce || StringUtils.isNotContains(tagSelector, TAG_SEPERATOR)) {
+            return tagAddresses.get(tagSelector);
+        }
+        String[] selectors = StringUtils.split(tagSelector, TAG_SEPERATOR);
+        for (int i = selectors.length; i > 0; i--) {
+            String selectorTmp = StringUtils.join(selectors, TAG_SEPERATOR, 0, i);
+            System.out.println(selectorTmp);

Review Comment:
   > please remove System.out.println
   
   ok



-- 
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@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] carlvine500 commented on pull request #12673: tag support multi level

Posted by "carlvine500 (via GitHub)" <gi...@apache.org>.
carlvine500 commented on PR #12673:
URL: https://github.com/apache/dubbo/pull/12673#issuecomment-1635539964

   > @carlvine500 Please update the following documentation accordingly:
   > 
   > https://cn.dubbo.apache.org/zh-cn/overview/core-features/traffic/#%E6%A0%87%E7%AD%BE%E8%B7%AF%E7%94%B1%E8%A7%84%E5%88%99
   > 
   > https://cn.dubbo.apache.org/zh-cn/overview/core-features/traffic/tag-rule/
   ok
   


-- 
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@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] sonarcloud[bot] commented on pull request #12673: tag support multi level

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #12673:
URL: https://github.com/apache/dubbo/pull/12673#issuecomment-1621265982

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=12673)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12673&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12673&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12673&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12673&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12673&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12673&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=12673&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=12673&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=12673&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12673&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12673&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12673&resolved=false&types=CODE_SMELL)
   
   [![89.5%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '89.5%')](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=12673&metric=new_coverage&view=list) [89.5% Coverage](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=12673&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=12673&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=12673&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] carlvine500 commented on a diff in pull request #12673: tag support multi level

Posted by "carlvine500 (via GitHub)" <gi...@apache.org>.
carlvine500 commented on code in PR #12673:
URL: https://github.com/apache/dubbo/pull/12673#discussion_r1300833835


##########
dubbo-dependencies-bom/pom.xml:
##########
@@ -96,7 +96,7 @@
         <javassist_version>3.29.2-GA</javassist_version>
         <bytebuddy.version>1.14.5</bytebuddy.version>
         <netty_version>3.2.10.Final</netty_version>
-        <netty4_version>4.1.92.Final</netty4_version>
+        <netty4_version>4.1.94.Final</netty4_version>

Review Comment:
   > Why change the version?
   
   4.1.92.Final has vulnerability ,  CVE-2023-34462. Severity: MEDIUM
   refer : https://mvnrepository.com/artifact/io.netty/netty-handler
   
   I will rollback it , hope dubbo community will upgrade it 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@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] wxbty commented on a diff in pull request #12673: tag support multi level

Posted by "wxbty (via GitHub)" <gi...@apache.org>.
wxbty commented on code in PR #12673:
URL: https://github.com/apache/dubbo/pull/12673#discussion_r1299883417


##########
dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouter.java:
##########
@@ -306,4 +309,35 @@ public void stop() {
     public void setTagRouterRule(TagRouterRule tagRouterRule) {
         this.tagRouterRule = tagRouterRule;
     }
+
+    /**
+     * select addresses by tag with level
+     * <p>
+     * example:
+     * selector=beta|team1|partner1
+     * step1.select tagAddresses with selector=beta|team1|partner1, if result is empty, then run step2
+     * step2.select tagAddresses with selector=beta|team1, if result is empty, then run step3
+     * step3.select tagAddresses with selector=beta, if result is empty, result is null
+     * </p>
+     *
+     * @param tagAddresses
+     * @param tagSelector  eg: beta|team1|partner1
+     * @return
+     */
+    public static Set<String> selectAddressByTagLevel(Map<String, Set<String>> tagAddresses, String tagSelector, boolean isForce) {
+        if (isForce || StringUtils.isNotContains(tagSelector, TAG_SEPERATOR)) {
+            return tagAddresses.get(tagSelector);
+        }
+        String[] selectors = StringUtils.split(tagSelector, TAG_SEPERATOR);
+        for (int i = selectors.length; i > 0; i--) {
+            String selectorTmp = StringUtils.join(selectors, TAG_SEPERATOR, 0, i);
+            System.out.println(selectorTmp);

Review Comment:
   please remove System.out.println



##########
dubbo-dependencies-bom/pom.xml:
##########
@@ -96,7 +96,7 @@
         <javassist_version>3.29.2-GA</javassist_version>
         <bytebuddy.version>1.14.5</bytebuddy.version>
         <netty_version>3.2.10.Final</netty_version>
-        <netty4_version>4.1.92.Final</netty4_version>
+        <netty4_version>4.1.94.Final</netty4_version>

Review Comment:
   Why change the version?



-- 
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@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on pull request #12673: tag support multi level

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on PR #12673:
URL: https://github.com/apache/dubbo/pull/12673#issuecomment-1687637874

   > > LGTM btw, please resolve conflicts with the master
   > 
   > I have no permission to merge to (apache:3.3)[apache:3.3](https://github.com/apache/dubbo/tree/3.3) , but I have tried merge to my git : https://github.com/carlvine500/dubbo/commits/3.3
   
   Merge apache:3.3 into **your** branch


-- 
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@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] carlvine500 commented on pull request #12673: tag support multi level

Posted by "carlvine500 (via GitHub)" <gi...@apache.org>.
carlvine500 commented on PR #12673:
URL: https://github.com/apache/dubbo/pull/12673#issuecomment-1687831117

   @AlbumenJ  failing test is not about this pull_request  .  


-- 
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@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] carlvine500 commented on pull request #12673: tag support multi level

Posted by "carlvine500 (via GitHub)" <gi...@apache.org>.
carlvine500 commented on PR #12673:
URL: https://github.com/apache/dubbo/pull/12673#issuecomment-1687608611

   > LGTM btw, please resolve conflicts with the master
   
   I have no permission to merge to [3.3](apache:3.3)[apache:3.3](https://github.com/apache/dubbo/tree/3.3) , but I have tried merge to my git : 
   https://github.com/carlvine500/dubbo/commits/3.3


-- 
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@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] chickenlj merged pull request #12673: tag support multi level

Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj merged PR #12673:
URL: https://github.com/apache/dubbo/pull/12673


-- 
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@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org