This is an automated email from the ASF dual-hosted git repository.
caogaofei pushed a commit to branch beyyes/leader_distribution_fix
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/beyyes/leader_distribution_fix
by this push:
new b12103103c fix problem in greedySelectLeader
b12103103c is described below
commit b12103103c69b7c641677bf52e7dde8f6284be6c
Author: Beyyes <[email protected]>
AuthorDate: Thu Nov 10 23:54:58 2022 +0800
fix 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;