You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "lordcheng10 (via GitHub)" <gi...@apache.org> on 2023/03/24 02:26:34 UTC

[GitHub] [pulsar] lordcheng10 opened a new pull request, #19889: [fix][broker] Fix the thread safety issue of BrokerData#getTimeAverageData access

lordcheng10 opened a new pull request, #19889:
URL: https://github.com/apache/pulsar/pull/19889

   ### Motivation
   In the updateBundleData method, when the following code is executed:
   https://github.com/apache/pulsar/blob/30d2469086fea989ac8baf059df8e69c66a68d89/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java#L591-L592
   
   In the reset method, information such as longTermMsgRateIn will be recalculated:
   <img width="1145" alt="image" src="https://user-images.githubusercontent.com/19296967/226811566-330033f9-1752-4697-b108-a41cac74615f.png">
   
   At this time, if brokerData.getTimeAverageData() is called in the LeastLongTermMessageRate#getScore method, the calculated score will be inaccurate:
   <img width="1155" alt="image" src="https://user-images.githubusercontent.com/19296967/226811780-4e3dc0c2-65ef-4e2d-ba8a-689cdc67a460.png">
   
   
   ### Modifications
   
   Create a new TimeAverageBrokerData object and perform a reset update. After the update is complete, call setTimeAverageData:
   ```
   TimeAverageBrokerData timeAverageData = new TimeAverageBrokerData();
   timeAverageData.reset(statsMap.keySet(), bundleData, defaultStats);
   brokerData.setTimeAverageData(timeAverageData);
   ```
   
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: https://github.com/lordcheng10/pulsar/pull/45
   


-- 
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] Technoboy- closed pull request #19889: [fix][broker] Fix the thread safety issue of BrokerData#getTimeAverageData access

Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- closed pull request #19889: [fix][broker] Fix the thread safety issue of BrokerData#getTimeAverageData access
URL: https://github.com/apache/pulsar/pull/19889


-- 
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] lordcheng10 merged pull request #19889: [fix][broker] Fix the thread safety issue of BrokerData#getTimeAverageData access

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


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