This is an automated email from the ASF dual-hosted git repository.

CRZbulabula pushed a commit to branch load-balance-patch
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 463d19f5c1e2a85b7caa9dc687cb1845683ef046
Author: Yongzao <[email protected]>
AuthorDate: Tue Apr 14 09:52:12 2026 +0800

    Load balance service patch (#17463)
---
 .../iotdb/confignode/manager/load/service/EventService.java    |  5 +++++
 .../db/queryengine/plan/analyze/ClusterPartitionFetcher.java   | 10 +++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/EventService.java
 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/EventService.java
index 5f6035f0bca..8267227c7ce 100644
--- 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/EventService.java
+++ 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/EventService.java
@@ -114,6 +114,11 @@ public class EventService {
         currentEventServiceFuture = null;
         LOGGER.info("Event service is stopped successfully.");
       }
+      synchronized (this) {
+        previousNodeStatisticsMap.clear();
+        previousRegionGroupStatisticsMap.clear();
+        previousConsensusGroupStatisticsMap.clear();
+      }
     }
   }
 
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java
index ff19dd79cf5..a160731fb24 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java
@@ -424,13 +424,17 @@ public class ClusterPartitionFetcher implements 
IPartitionFetcher {
 
       Map<TSeriesPartitionSlot, TConsensusGroupId> orderedMap =
           new LinkedHashMap<>(entry1.getValue());
-      List<TConsensusGroupId> orderedGroupIds = new 
ArrayList<>(orderedMap.values());
+      List<TConsensusGroupId> orderedGroupIds =
+          orderedMap.values().stream().distinct().collect(Collectors.toList());
       List<TRegionReplicaSet> regionReplicaSets =
           partitionCache.getRegionReplicaSet(orderedGroupIds);
+      Map<TConsensusGroupId, TRegionReplicaSet> groupIdToReplicaSet = new 
HashMap<>();
+      for (int index = 0; index < orderedGroupIds.size(); index++) {
+        groupIdToReplicaSet.put(orderedGroupIds.get(index), 
regionReplicaSets.get(index));
+      }
 
-      int index = 0;
       for (Map.Entry<TSeriesPartitionSlot, TConsensusGroupId> entry2 : 
orderedMap.entrySet()) {
-        result1.put(entry2.getKey(), regionReplicaSets.get(index++));
+        result1.put(entry2.getKey(), 
groupIdToReplicaSet.get(entry2.getValue()));
       }
     }
 

Reply via email to