You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/03/12 09:35:24 UTC

[GitHub] [pulsar] Jason918 opened a new pull request #14666: [Broker] Fix precision issue and initial value for Consumer#avgMessagesPerEntry

Jason918 opened a new pull request #14666:
URL: https://github.com/apache/pulsar/pull/14666


   ### Motivation
   
   1. Precision issue
   There is precision issue to use int type for `Consumer#avgMessagesPerEntry`.
   ```
   tmpAvgMessagesPerEntry = (int) Math.floor(tmpAvgMessagesPerEntry * avgPercent
                   + (1 - avgPercent) * totalMessages / entries.size());
   ```
   
   For example, if `tmpAvgMessagesPerEntry` = 1 and new value of  `totalMessages / entries.size()` is always 5,  then the `tmpAvgMessagesPerEntry` is always 1 and never increase.
   
   2.  Initial value issue.
   And the init value of 1000 seems confusing in consumerStats for users, and it need quite a long time to decrease if message rate is very slow.
   
   ### Modifications
   
   1. Change type of avgMessagesPerEntry to double. 
   2. Change init value from 1000 to first `totalMessages / entries.size()`.
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API: (no)
     - The schema: (no)
     - The default values of configurations: (no)
     - The wire protocol: (no)
     - The rest endpoints: (no)
     - The admin cli options: (no)
     - Anything that affects deployment: (no)
   
   ### Documentation
   
   Check the box below and label this PR (if you have committer privilege).
   
   Need to update docs? 
     
   - [x] `no-need-doc` 
   Internal  fix.


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

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



[GitHub] [pulsar] codelipenghui merged pull request #14666: [Broker] Fix precision issue and initial value for Consumer#avgMessagesPerEntry

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #14666:
URL: https://github.com/apache/pulsar/pull/14666


   


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

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