You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/08/05 08:30:01 UTC

[GitHub] [rocketmq] lfz757077613 opened a new pull request #3220: change Random to ThreadLocalRandom in broker

lfz757077613 opened a new pull request #3220:
URL: https://github.com/apache/rocketmq/pull/3220


   Broker use Math.abs(random.nextInt() % 99999999) to choose a queue for message, which is not necessary
   
   It can be replaced with ThreadLocalRandom.current().nextInt(99999999) for higher performance


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

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



[GitHub] [rocketmq] lfz757077613 commented on a change in pull request #3220: [ISSUE #3225]change Random to ThreadLocalRandom in broker

Posted by GitBox <gi...@apache.org>.
lfz757077613 commented on a change in pull request #3220:
URL: https://github.com/apache/rocketmq/pull/3220#discussion_r684046311



##########
File path: broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java
##########
@@ -109,7 +109,7 @@ protected MessageExtBrokerInner buildInnerMsg(final ChannelHandlerContext ctx,
         final SendMessageRequestHeader requestHeader, final byte[] body, TopicConfig topicConfig) {
         int queueIdInt = requestHeader.getQueueId();
         if (queueIdInt < 0) {
-            queueIdInt = Math.abs(this.random.nextInt() % 99999999) % topicConfig.getWriteQueueNums();

Review comment:
       `ThreadLocalRandom.current().nextInt(99999999)` should be positive always
   




-- 
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: dev-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 #3220: change Random to ThreadLocalRandom in broker

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


   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/3220?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 [#3220](https://codecov.io/gh/apache/rocketmq/pull/3220?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (805b6ff) into [develop](https://codecov.io/gh/apache/rocketmq/commit/44bdeedad2d0e28717f5012d375d12af76305bb5?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (44bdeed) will **increase** coverage by `0.00%`.
   > The diff coverage is `25.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/rocketmq/pull/3220/graphs/tree.svg?width=650&height=150&src=pr&token=4w0sxP1wZv&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/rocketmq/pull/3220?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             @@
   ##             develop    #3220   +/-   ##
   ==========================================
     Coverage      47.95%   47.96%           
   + Complexity      4565     4562    -3     
   ==========================================
     Files            552      552           
     Lines          36521    36519    -2     
     Branches        4818     4818           
   ==========================================
   + Hits           17514    17516    +2     
   + Misses         16795    16794    -1     
   + Partials        2212     2209    -3     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/3220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...broker/processor/AbstractSendMessageProcessor.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL0Fic3RyYWN0U2VuZE1lc3NhZ2VQcm9jZXNzb3IuamF2YQ==) | `49.30% <0.00%> (-0.24%)` | :arrow_down: |
   | [...cketmq/broker/processor/ReplyMessageProcessor.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL1JlcGx5TWVzc2FnZVByb2Nlc3Nvci5qYXZh) | `54.91% <0.00%> (ø)` | |
   | [...ion/AbstractTransactionalMessageCheckListener.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvdHJhbnNhY3Rpb24vQWJzdHJhY3RUcmFuc2FjdGlvbmFsTWVzc2FnZUNoZWNrTGlzdGVuZXIuamF2YQ==) | `75.67% <ø> (-0.65%)` | :arrow_down: |
   | [...ocketmq/broker/processor/SendMessageProcessor.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL1NlbmRNZXNzYWdlUHJvY2Vzc29yLmphdmE=) | `40.26% <20.00%> (ø)` | |
   | [...ueue/DefaultTransactionalMessageCheckListener.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvdHJhbnNhY3Rpb24vcXVldWUvRGVmYXVsdFRyYW5zYWN0aW9uYWxNZXNzYWdlQ2hlY2tMaXN0ZW5lci5qYXZh) | `84.37% <100.00%> (ø)` | |
   | [...rg/apache/rocketmq/common/stats/StatsSnapshot.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNTbmFwc2hvdC5qYXZh) | `84.61% <0.00%> (-15.39%)` | :arrow_down: |
   | [.../apache/rocketmq/common/stats/MomentStatsItem.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvTW9tZW50U3RhdHNJdGVtLmphdmE=) | `38.09% <0.00%> (-9.53%)` | :arrow_down: |
   | [...ache/rocketmq/common/stats/MomentStatsItemSet.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvTW9tZW50U3RhdHNJdGVtU2V0LmphdmE=) | `39.13% <0.00%> (-8.70%)` | :arrow_down: |
   | [...pache/rocketmq/test/listener/AbstractListener.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-dGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvdGVzdC9saXN0ZW5lci9BYnN0cmFjdExpc3RlbmVyLmphdmE=) | `66.66% <0.00%> (-7.41%)` | :arrow_down: |
   | [...va/org/apache/rocketmq/common/stats/StatsItem.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNJdGVtLmphdmE=) | `50.00% <0.00%> (-5.00%)` | :arrow_down: |
   | ... and [12 more](https://codecov.io/gh/apache/rocketmq/pull/3220/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/rocketmq/pull/3220?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/rocketmq/pull/3220?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 [44bdeed...805b6ff](https://codecov.io/gh/apache/rocketmq/pull/3220?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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] odbozhou commented on a change in pull request #3220: [ISSUE #3225]change Random to ThreadLocalRandom in broker

Posted by GitBox <gi...@apache.org>.
odbozhou commented on a change in pull request #3220:
URL: https://github.com/apache/rocketmq/pull/3220#discussion_r684013282



##########
File path: broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java
##########
@@ -109,7 +109,7 @@ protected MessageExtBrokerInner buildInnerMsg(final ChannelHandlerContext ctx,
         final SendMessageRequestHeader requestHeader, final byte[] body, TopicConfig topicConfig) {
         int queueIdInt = requestHeader.getQueueId();
         if (queueIdInt < 0) {
-            queueIdInt = Math.abs(this.random.nextInt() % 99999999) % topicConfig.getWriteQueueNums();

Review comment:
       ThreadLocalRandom.current().nextInt() and random.nextInt() may produce negative numbers, if you remove Math.abs, there will be problems.




-- 
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: dev-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 #3220: change Random to ThreadLocalRandom in broker

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


   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/3220?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 [#3220](https://codecov.io/gh/apache/rocketmq/pull/3220?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (805b6ff) into [develop](https://codecov.io/gh/apache/rocketmq/commit/44bdeedad2d0e28717f5012d375d12af76305bb5?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (44bdeed) will **increase** coverage by `0.00%`.
   > The diff coverage is `25.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/rocketmq/pull/3220/graphs/tree.svg?width=650&height=150&src=pr&token=4w0sxP1wZv&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/rocketmq/pull/3220?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             @@
   ##             develop    #3220   +/-   ##
   ==========================================
     Coverage      47.95%   47.96%           
   + Complexity      4565     4562    -3     
   ==========================================
     Files            552      552           
     Lines          36521    36519    -2     
     Branches        4818     4818           
   ==========================================
   + Hits           17514    17516    +2     
   + Misses         16795    16794    -1     
   + Partials        2212     2209    -3     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/3220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...broker/processor/AbstractSendMessageProcessor.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL0Fic3RyYWN0U2VuZE1lc3NhZ2VQcm9jZXNzb3IuamF2YQ==) | `49.30% <0.00%> (-0.24%)` | :arrow_down: |
   | [...cketmq/broker/processor/ReplyMessageProcessor.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL1JlcGx5TWVzc2FnZVByb2Nlc3Nvci5qYXZh) | `54.91% <0.00%> (ø)` | |
   | [...ion/AbstractTransactionalMessageCheckListener.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvdHJhbnNhY3Rpb24vQWJzdHJhY3RUcmFuc2FjdGlvbmFsTWVzc2FnZUNoZWNrTGlzdGVuZXIuamF2YQ==) | `75.67% <ø> (-0.65%)` | :arrow_down: |
   | [...ocketmq/broker/processor/SendMessageProcessor.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL1NlbmRNZXNzYWdlUHJvY2Vzc29yLmphdmE=) | `40.26% <20.00%> (ø)` | |
   | [...ueue/DefaultTransactionalMessageCheckListener.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvdHJhbnNhY3Rpb24vcXVldWUvRGVmYXVsdFRyYW5zYWN0aW9uYWxNZXNzYWdlQ2hlY2tMaXN0ZW5lci5qYXZh) | `84.37% <100.00%> (ø)` | |
   | [...rg/apache/rocketmq/common/stats/StatsSnapshot.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNTbmFwc2hvdC5qYXZh) | `84.61% <0.00%> (-15.39%)` | :arrow_down: |
   | [.../apache/rocketmq/common/stats/MomentStatsItem.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvTW9tZW50U3RhdHNJdGVtLmphdmE=) | `38.09% <0.00%> (-9.53%)` | :arrow_down: |
   | [...ache/rocketmq/common/stats/MomentStatsItemSet.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvTW9tZW50U3RhdHNJdGVtU2V0LmphdmE=) | `39.13% <0.00%> (-8.70%)` | :arrow_down: |
   | [...pache/rocketmq/test/listener/AbstractListener.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-dGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvdGVzdC9saXN0ZW5lci9BYnN0cmFjdExpc3RlbmVyLmphdmE=) | `66.66% <0.00%> (-7.41%)` | :arrow_down: |
   | [...va/org/apache/rocketmq/common/stats/StatsItem.java](https://codecov.io/gh/apache/rocketmq/pull/3220/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNJdGVtLmphdmE=) | `50.00% <0.00%> (-5.00%)` | :arrow_down: |
   | ... and [12 more](https://codecov.io/gh/apache/rocketmq/pull/3220/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/rocketmq/pull/3220?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/rocketmq/pull/3220?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 [44bdeed...805b6ff](https://codecov.io/gh/apache/rocketmq/pull/3220?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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] odbozhou commented on a change in pull request #3220: change Random to ThreadLocalRandom in broker

Posted by GitBox <gi...@apache.org>.
odbozhou commented on a change in pull request #3220:
URL: https://github.com/apache/rocketmq/pull/3220#discussion_r683984548



##########
File path: broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java
##########
@@ -109,7 +109,7 @@ protected MessageExtBrokerInner buildInnerMsg(final ChannelHandlerContext ctx,
         final SendMessageRequestHeader requestHeader, final byte[] body, TopicConfig topicConfig) {
         int queueIdInt = requestHeader.getQueueId();
         if (queueIdInt < 0) {
-            queueIdInt = Math.abs(this.random.nextInt() % 99999999) % topicConfig.getWriteQueueNums();

Review comment:
       Why was Math.abs deleted?




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

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



[GitHub] [rocketmq] lfz757077613 commented on pull request #3220: [ISSUE #3225]change Random to ThreadLocalRandom in broker

Posted by GitBox <gi...@apache.org>.
lfz757077613 commented on pull request #3220:
URL: https://github.com/apache/rocketmq/pull/3220#issuecomment-917822201


   > Sorry! There is no issue with the code, but some errors occurred when we released the version, which led to the introduction of commits that should not be introduced. Could you resubmit a pull request with the latest develop branch code?
   
   done


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

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



[GitHub] [rocketmq] lfz757077613 commented on a change in pull request #3220: [ISSUE #3225]change Random to ThreadLocalRandom in broker

Posted by GitBox <gi...@apache.org>.
lfz757077613 commented on a change in pull request #3220:
URL: https://github.com/apache/rocketmq/pull/3220#discussion_r683993225



##########
File path: broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java
##########
@@ -109,7 +109,7 @@ protected MessageExtBrokerInner buildInnerMsg(final ChannelHandlerContext ctx,
         final SendMessageRequestHeader requestHeader, final byte[] body, TopicConfig topicConfig) {
         int queueIdInt = requestHeader.getQueueId();
         if (queueIdInt < 0) {
-            queueIdInt = Math.abs(this.random.nextInt() % 99999999) % topicConfig.getWriteQueueNums();

Review comment:
       It's meaningless there, I have related it to an Issue




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

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



[GitHub] [rocketmq] coveralls commented on pull request #3220: change Random to ThreadLocalRandom in broker

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #3220:
URL: https://github.com/apache/rocketmq/pull/3220#issuecomment-893286888


   
   [![Coverage Status](https://coveralls.io/builds/41924903/badge)](https://coveralls.io/builds/41924903)
   
   Coverage increased (+0.04%) to 54.135% when pulling **805b6ffb29bc21de6a64310f98ac108a543108a9 on lfz757077613:useThreadLocalRandom** into **44bdeedad2d0e28717f5012d375d12af76305bb5 on apache:develop**.
   


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

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



[GitHub] [rocketmq] lfz757077613 commented on a change in pull request #3220: [ISSUE #3225]change Random to ThreadLocalRandom in broker

Posted by GitBox <gi...@apache.org>.
lfz757077613 commented on a change in pull request #3220:
URL: https://github.com/apache/rocketmq/pull/3220#discussion_r684046311



##########
File path: broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java
##########
@@ -109,7 +109,7 @@ protected MessageExtBrokerInner buildInnerMsg(final ChannelHandlerContext ctx,
         final SendMessageRequestHeader requestHeader, final byte[] body, TopicConfig topicConfig) {
         int queueIdInt = requestHeader.getQueueId();
         if (queueIdInt < 0) {
-            queueIdInt = Math.abs(this.random.nextInt() % 99999999) % topicConfig.getWriteQueueNums();

Review comment:
       As the java doc of Random, it show be positive always
   ![image](https://user-images.githubusercontent.com/16242100/128480577-fac14815-1bcf-4847-966e-adabb41935c5.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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] RongtongJin merged pull request #3220: [ISSUE #3225]change Random to ThreadLocalRandom in broker

Posted by GitBox <gi...@apache.org>.
RongtongJin merged pull request #3220:
URL: https://github.com/apache/rocketmq/pull/3220


   


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

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



[GitHub] [rocketmq] RongtongJin commented on pull request #3220: [ISSUE #3225]change Random to ThreadLocalRandom in broker

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


   Sorry! There is no issue with the code, but some errors occurred when we released the version, which led to the introduction of commits that should not be introduced. Could you resubmit a pull request with the latest develop branch code?


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

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



[GitHub] [rocketmq] coveralls commented on pull request #3220: change Random to ThreadLocalRandom in broker

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #3220:
URL: https://github.com/apache/rocketmq/pull/3220#issuecomment-893286888


   
   [![Coverage Status](https://coveralls.io/builds/41924903/badge)](https://coveralls.io/builds/41924903)
   
   Coverage increased (+0.04%) to 54.135% when pulling **805b6ffb29bc21de6a64310f98ac108a543108a9 on lfz757077613:useThreadLocalRandom** into **44bdeedad2d0e28717f5012d375d12af76305bb5 on apache:develop**.
   


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

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