Skip to content

Commit eaa2c38

Browse files
authored
Load balance service patch (#17463)
1 parent 609d28b commit eaa2c38

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/EventService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ public void stopEventService() {
115115
currentEventServiceFuture = null;
116116
LOGGER.info("Event service is stopped successfully.");
117117
}
118+
synchronized (this) {
119+
previousNodeStatisticsMap.clear();
120+
previousRegionGroupStatisticsMap.clear();
121+
previousConsensusGroupStatisticsMap.clear();
122+
}
118123
}
119124
}
120125

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,13 +523,17 @@ private SchemaPartition parseSchemaPartitionTableResp(
523523

524524
Map<TSeriesPartitionSlot, TConsensusGroupId> orderedMap =
525525
new LinkedHashMap<>(entry1.getValue());
526-
List<TConsensusGroupId> orderedGroupIds = new ArrayList<>(orderedMap.values());
526+
List<TConsensusGroupId> orderedGroupIds =
527+
orderedMap.values().stream().distinct().collect(Collectors.toList());
527528
List<TRegionReplicaSet> regionReplicaSets =
528529
partitionCache.getRegionReplicaSet(orderedGroupIds);
530+
Map<TConsensusGroupId, TRegionReplicaSet> groupIdToReplicaSet = new HashMap<>();
531+
for (int index = 0; index < orderedGroupIds.size(); index++) {
532+
groupIdToReplicaSet.put(orderedGroupIds.get(index), regionReplicaSets.get(index));
533+
}
529534

530-
int index = 0;
531535
for (Map.Entry<TSeriesPartitionSlot, TConsensusGroupId> entry2 : orderedMap.entrySet()) {
532-
result1.put(entry2.getKey(), regionReplicaSets.get(index++));
536+
result1.put(entry2.getKey(), groupIdToReplicaSet.get(entry2.getValue()));
533537
}
534538
}
535539
return new SchemaPartition(

0 commit comments

Comments
 (0)