This is an automated email from the ASF dual-hosted git repository.
CRZbulabula pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new a6c654bde56 Fix RegionGroupCache activation race (#18128)
a6c654bde56 is described below
commit a6c654bde5693a0dc293f153cba9deec87243f60
Author: Caideyipi <[email protected]>
AuthorDate: Tue Jul 7 11:56:50 2026 +0800
Fix RegionGroupCache activation race (#18128)
---
.../confignode/manager/load/cache/region/RegionGroupCache.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/region/RegionGroupCache.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/region/RegionGroupCache.java
index e441054b1df..2cdecc757fd 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/region/RegionGroupCache.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/region/RegionGroupCache.java
@@ -66,7 +66,7 @@ public class RegionGroupCache {
* @param newHeartbeatSample The newest RegionHeartbeatSample
* @param overwrite Able to overwrite Adding or Removing
*/
- public void cacheHeartbeatSample(
+ public synchronized void cacheHeartbeatSample(
int dataNodeId, RegionHeartbeatSample newHeartbeatSample, boolean
overwrite) {
// Only cache sample when the corresponding loadCache exists
Optional.ofNullable(regionCacheMap.get(dataNodeId))
@@ -83,7 +83,7 @@ public class RegionGroupCache {
*
* @param dataNodeId the specified DataNode
*/
- public void createRegionCache(int dataNodeId, TConsensusGroupId groupId) {
+ public synchronized void createRegionCache(int dataNodeId, TConsensusGroupId
groupId) {
regionCacheMap.put(dataNodeId, new RegionCache(dataNodeId, groupId));
}
@@ -92,7 +92,7 @@ public class RegionGroupCache {
*
* @param dataNodeId the specified DataNode
*/
- public void removeRegionCache(int dataNodeId) {
+ public synchronized void removeRegionCache(int dataNodeId) {
regionCacheMap.remove(dataNodeId);
}
@@ -100,7 +100,7 @@ public class RegionGroupCache {
* Update currentStatistics based on the latest NodeHeartbeatSamples that
cached in the
* slidingWindow.
*/
- public void updateCurrentStatistics() {
+ public synchronized void updateCurrentStatistics() {
regionCacheMap.values().forEach(regionCache ->
regionCache.updateCurrentStatistics(false));
Map<Integer, RegionStatistics> regionStatisticsMap =
regionCacheMap.entrySet().stream()