You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ca...@apache.org on 2022/11/10 15:43:00 UTC
[iotdb] 03/03: fix the problem in greedySelectLeader
This is an automated email from the ASF dual-hosted git repository.
caogaofei pushed a commit to branch beyyes/fix_leader_distribution
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit f37acbbc2d27357bcff30b1ce6d0a30436d9459f
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Thu Nov 10 23:42:40 2022 +0800
fix the problem in greedySelectLeader
---
.../iotdb/confignode/manager/load/balancer/RouteBalancer.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
index 76b37dff45..5ed4134658 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
@@ -205,12 +205,14 @@ public class RouteBalancer {
Map<Integer, AtomicInteger> leaderCounter = new HashMap<>();
regionRouteMap
.getRegionLeaderMap()
- .values()
.forEach(
- leaderId ->
+ (consensusGroupId, leaderId) -> {
+ if (TConsensusGroupType.DataRegion.equals(consensusGroupId.getType())) {
leaderCounter
.computeIfAbsent(leaderId, empty -> new AtomicInteger(0))
- .getAndIncrement());
+ .getAndIncrement();
+ }
+ });
int newLeaderId = -1;
int minCount = Integer.MAX_VALUE;