This is an automated email from the ASF dual-hosted git repository.
lordcheng10 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 19c84977f00 [fix][broker] Fix the thread safety issue of
BrokerData#getTimeAverageData access (#19889)
19c84977f00 is described below
commit 19c84977f00033ef9601f43f1b703068a6207536
Author: LinChen <[email protected]>
AuthorDate: Mon Mar 27 15:18:01 2023 +0800
[fix][broker] Fix the thread safety issue of BrokerData#getTimeAverageData
access (#19889)
Co-authored-by: lordcheng10 <[email protected]>
---
.../apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
index f135840d60e..4756b885ff2 100644
---
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
+++
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
@@ -589,7 +589,9 @@ public class ModularLoadManagerImpl implements
ModularLoadManager {
}
// Using the newest data, update the aggregated time-average data
for the current broker.
- brokerData.getTimeAverageData().reset(statsMap.keySet(),
bundleData, defaultStats);
+ TimeAverageBrokerData timeAverageData = new
TimeAverageBrokerData();
+ timeAverageData.reset(statsMap.keySet(), bundleData, defaultStats);
+ brokerData.setTimeAverageData(timeAverageData);
final ConcurrentOpenHashMap<String, ConcurrentOpenHashSet<String>>
namespaceToBundleRange =
brokerToNamespaceToBundleRange
.computeIfAbsent(broker, k ->