You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2023/01/20 04:06:09 UTC

[GitHub] [rocketmq] yuz10 opened a new pull request, #5909: [ISSUE #5684] request code should be short, to support serializeTypeCurrentRPC=ROCKETMQ

yuz10 opened a new pull request, #5909:
URL: https://github.com/apache/rocketmq/pull/5909

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   #5684
   
   ## Brief changelog
   
   XX
   
   ## Verifying this change
   
   XXXX
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed 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. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) 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 integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] yuz10 commented on a diff in pull request #5909: [ISSUE #5684] request code should be short, to support serializeTypeCurrentRPC=ROCKETMQ

Posted by GitBox <gi...@apache.org>.
yuz10 commented on code in PR #5909:
URL: https://github.com/apache/rocketmq/pull/5909#discussion_r1082176499


##########
remoting/src/test/java/org/apache/rocketmq/remoting/protocol/RequestCodeTest.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.remoting.protocol;
+
+import java.lang.reflect.Field;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class RequestCodeTest {
+
+    @Test
+    public void testRequestCodeShouldBeShort() throws IllegalAccessException {
+        Set<String> ignored = new HashSet<>();
+        ignored.add("POP_MESSAGE");
+        ignored.add("ACK_MESSAGE");
+        ignored.add("PEEK_MESSAGE");
+        ignored.add("CHANGE_MESSAGE_INVISIBLETIME");
+        ignored.add("NOTIFICATION");
+        ignored.add("POLLING_INFO");
+        Class clazz = RequestCode.class;
+        Field[] fields = clazz.getFields();
+        for (Field field : fields) {
+            if (ignored.contains(field.getName())) {
+                continue;
+            }
+            if (field.getInt(clazz) > Short.MAX_VALUE) {
+                Assert.fail(field.getName() + "=" + field.getInt(clazz) + " should be short, to support serializeTypeCurrentRPC=ROCKETMQ");
+            }
+        }
+    }
+}

Review Comment:
   done, Thanks for your advice



-- 
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: commits-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] yuz10 commented on pull request #5909: [ISSUE #5684] request code should be short, to support serializeTypeCurrentRPC=ROCKETMQ

Posted by "yuz10 (via GitHub)" <gi...@apache.org>.
yuz10 commented on PR #5909:
URL: https://github.com/apache/rocketmq/pull/5909#issuecomment-1621924687

   @RongtongJin @echooymxq @HScarb Please review the code again.


-- 
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: commits-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] codecov-commenter commented on pull request #5909: [ISSUE #5684] request code should be short, to support serializeTypeCurrentRPC=ROCKETMQ

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

   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/5909?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 [#5909](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ad804e8) into [develop](https://codecov.io/gh/apache/rocketmq/commit/f488e20dc91a8b4ac48c4a8c5556c9f38abdb71e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f488e20) will **increase** coverage by `0.00%`.
   > The diff coverage is `100.00%`.
   
   > :exclamation: Current head ad804e8 differs from pull request most recent head 3d6c096. Consider uploading reports for the commit 3d6c096 to get more accurate results
   
   ```diff
   @@            Coverage Diff             @@
   ##             develop    #5909   +/-   ##
   ==========================================
     Coverage      43.37%   43.37%           
     Complexity      8809     8809           
   ==========================================
     Files           1090     1090           
     Lines          76412    76409    -3     
     Branches        9981     9981           
   ==========================================
   - Hits           33145    33144    -1     
   - Misses         39118    39126    +8     
   + Partials        4149     4139   -10     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...e/rocketmq/remoting/netty/NettyRemotingServer.java](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3Rpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3JlbW90aW5nL25ldHR5L05ldHR5UmVtb3RpbmdTZXJ2ZXIuamF2YQ==) | `59.53% <100.00%> (+0.26%)` | :arrow_up: |
   | [...rg/apache/rocketmq/common/stats/StatsSnapshot.java](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNTbmFwc2hvdC5qYXZh) | `84.61% <0.00%> (-15.39%)` | :arrow_down: |
   | [.../apache/rocketmq/common/stats/MomentStatsItem.java](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvTW9tZW50U3RhdHNJdGVtLmphdmE=) | `38.09% <0.00%> (-9.53%)` | :arrow_down: |
   | [...va/org/apache/rocketmq/store/FlushDiskWatcher.java](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL0ZsdXNoRGlza1dhdGNoZXIuamF2YQ==) | `81.25% <0.00%> (-9.38%)` | :arrow_down: |
   | [...ache/rocketmq/common/stats/MomentStatsItemSet.java](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvTW9tZW50U3RhdHNJdGVtU2V0LmphdmE=) | `39.13% <0.00%> (-8.70%)` | :arrow_down: |
   | [...va/org/apache/rocketmq/common/stats/StatsItem.java](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNJdGVtLmphdmE=) | `50.00% <0.00%> (-4.17%)` | :arrow_down: |
   | [...tmq/remoting/protocol/body/ConsumerConnection.java](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3Rpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3JlbW90aW5nL3Byb3RvY29sL2JvZHkvQ29uc3VtZXJDb25uZWN0aW9uLmphdmE=) | `95.83% <0.00%> (-4.17%)` | :arrow_down: |
   | [...mq/broker/topic/TopicQueueMappingCleanService.java](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvdG9waWMvVG9waWNRdWV1ZU1hcHBpbmdDbGVhblNlcnZpY2UuamF2YQ==) | `12.43% <0.00%> (-3.63%)` | :arrow_down: |
   | [...org/apache/rocketmq/common/stats/StatsItemSet.java](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNJdGVtU2V0LmphdmE=) | `41.79% <0.00%> (-2.99%)` | :arrow_down: |
   | [...c/main/java/org/apache/rocketmq/common/MixAll.java](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vTWl4QWxsLmphdmE=) | `41.44% <0.00%> (-1.29%)` | :arrow_down: |
   | ... and [12 more](https://codecov.io/gh/apache/rocketmq/pull/5909?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :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: commits-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] RongtongJin commented on a diff in pull request #5909: [ISSUE #5684] request code should be short, to support serializeTypeCurrentRPC=ROCKETMQ

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on code in PR #5909:
URL: https://github.com/apache/rocketmq/pull/5909#discussion_r1082113808


##########
remoting/src/test/java/org/apache/rocketmq/remoting/protocol/RequestCodeTest.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.remoting.protocol;
+
+import java.lang.reflect.Field;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class RequestCodeTest {
+
+    @Test
+    public void testRequestCodeShouldBeShort() throws IllegalAccessException {
+        Set<String> ignored = new HashSet<>();
+        ignored.add("POP_MESSAGE");
+        ignored.add("ACK_MESSAGE");
+        ignored.add("PEEK_MESSAGE");
+        ignored.add("CHANGE_MESSAGE_INVISIBLETIME");
+        ignored.add("NOTIFICATION");
+        ignored.add("POLLING_INFO");
+        Class clazz = RequestCode.class;
+        Field[] fields = clazz.getFields();
+        for (Field field : fields) {
+            if (ignored.contains(field.getName())) {
+                continue;
+            }
+            if (field.getInt(clazz) > Short.MAX_VALUE) {
+                Assert.fail(field.getName() + "=" + field.getInt(clazz) + " should be short, to support serializeTypeCurrentRPC=ROCKETMQ");
+            }
+        }
+    }
+}

Review Comment:
   It would be better to add a UT to prohibit the use of code which be converted to short in ignored hashset.  For example, developers should be prohibited from using code of 3442((short)RequestCode.POP_MESSAGE).



##########
remoting/src/test/java/org/apache/rocketmq/remoting/protocol/RequestCodeTest.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.remoting.protocol;
+
+import java.lang.reflect.Field;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class RequestCodeTest {
+
+    @Test
+    public void testRequestCodeShouldBeShort() throws IllegalAccessException {
+        Set<String> ignored = new HashSet<>();
+        ignored.add("POP_MESSAGE");
+        ignored.add("ACK_MESSAGE");
+        ignored.add("PEEK_MESSAGE");
+        ignored.add("CHANGE_MESSAGE_INVISIBLETIME");
+        ignored.add("NOTIFICATION");
+        ignored.add("POLLING_INFO");
+        Class clazz = RequestCode.class;
+        Field[] fields = clazz.getFields();
+        for (Field field : fields) {
+            if (ignored.contains(field.getName())) {
+                continue;
+            }
+            if (field.getInt(clazz) > Short.MAX_VALUE) {
+                Assert.fail(field.getName() + "=" + field.getInt(clazz) + " should be short, to support serializeTypeCurrentRPC=ROCKETMQ");
+            }
+        }
+    }
+}

Review Comment:
   It would be better to add a UT to prohibit the use of code which be converted to short in ignored hashset.  For example, developers should be prohibited from using code of 3442((short)RequestCode.POP_MESSAGE).



-- 
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: commits-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] RongtongJin commented on pull request #5909: [ISSUE #5684] request code should be short, to support serializeTypeCurrentRPC=ROCKETMQ

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on PR #5909:
URL: https://github.com/apache/rocketmq/pull/5909#issuecomment-1397930812

   Error:  /home/runner/work/rocketmq/rocketmq/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:368:2: 'method def rcurly' has incorrect indentation level 1, expected level should be 4. [Indentation]


-- 
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: commits-unsubscribe@rocketmq.apache.org

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