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 2020/07/16 13:12:31 UTC

[GitHub] [rocketmq] yafeites opened a new issue #2168: The redundance of org.apache.rocketmq.client.consumer.rebalance.AllocateMessageQueueAveragely.allocate()

yafeites opened a new issue #2168:
URL: https://github.com/apache/rocketmq/issues/2168


   The issue tracker is **ONLY** used for bug report(feature request need to follow [RIP process](https://github.com/apache/rocketmq/wiki/RocketMQ-Improvement-Proposal)). Keep in mind, please check whether there is an existing same report before your raise a new one.
   
   Alternately (especially if your communication is not a bug report), you can send mail to our [mailing lists](http://rocketmq.apache.org/about/contact/). We welcome any friendly suggestions, bug fixes, collaboration and other improvements.
   
   Please ensure that your bug report is clear and that it is complete. Otherwise, we may be unable to understand it or to reproduce it, either of which would prevent us from fixing the bug. We strongly recommend the report(bug report or feature request) could include some hints as the following:
   
   **BUG REPORT**
   
   1. Please describe the issue you observed:
    **The redundance of org.apache.rocketmq.client.consumer.rebalance.AllocateMessageQueueAveragely.allocate()**
    when we calculate the queue  where the client will pull the message,we need't to take remainder to the mqAll.size().Bescuse the startIndex+ range is samller than the mqAll.size()
   - What did you do (The steps to reproduce)?
   i run the demo to check whether is right
   the following is the code
   
   ```java
   public static void main(String[] args) {
           for (int i = 0; i < 10000; i++) {
               int n=100;
               Random random=new Random();
               int mqSize=random.nextInt(n)+1;
               int cSize=random.nextInt(n)+1;
               int index =random.nextInt(cSize);
               int mod = mqSize % cSize;
               int averageSize =
                       mqSize<= cSize ? 1 : (mod > 0 && index < mod ? mqSize / cSize
                               + 1 : mqSize / cSize);
               int startIndex = (mod > 0 && index < mod) ? index * averageSize : index * averageSize + mod;
               int range = Math.min(averageSize, mqSize - startIndex);
               for (int j = 0; j < range; j++) {
                   if(((startIndex + j) % mqSize)==(startIndex + j))
                   {
                       continue;
                   }
                   System.out.println("range:"+range+"index:"+index+"mod:"+mod+"averageSize:"+averageSize+"startIndex:"+startIndex+"mqSize:"+mqSize+"cSize:"+cSize);
                   break;
               }
   
           }
   ```
   
   finally i find it' right
   
   - What did you expect to see?
   delete the  remainder of  mqAll.size()
   - What did you see instead?
   
   2. Please tell us about your environment:
   jdk 8  Intellij IDEA2020 win10
   3. Other information (e.g. detailed explanation, logs, related issues, suggestions how to fix, etc):
   
   **FEATURE REQUEST**
   
   1. Please describe the feature you are requesting.
   
   2. Provide any additional detail on your proposed use case for this feature.
   
   2. Indicate the importance of this issue to you (blocker, must-have, should-have, nice-to-have). Are you currently using any workarounds to address this issue?
   
   4. If there are some sub-tasks using -[] for each subtask and create a corresponding issue to map to the sub task:
   
   - [sub-task1-issue-number](example_sub_issue1_link_here): sub-task1 description here, 
   - [sub-task2-issue-number](example_sub_issue2_link_here): sub-task2 description here,
   - ...
   


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

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



[GitHub] [rocketmq] RongtongJin closed issue #2168: The redundance of org.apache.rocketmq.client.consumer.rebalance.AllocateMessageQueueAveragely.allocate()

Posted by GitBox <gi...@apache.org>.
RongtongJin closed issue #2168:
URL: https://github.com/apache/rocketmq/issues/2168


   


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

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