This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/dev/1.3 by this push:
new 4d8e1cd8f0c Fix flush old leader NPE when rebanlce #14981 (#14985)
4d8e1cd8f0c is described below
commit 4d8e1cd8f0c501a5aef744775ca1e83556191220
Author: Peng Junzhi <[email protected]>
AuthorDate: Fri Feb 28 11:55:38 2025 +0800
Fix flush old leader NPE when rebanlce #14981 (#14985)
(cherry picked from commit aad2caa9f22d207b7e44068d11aad01e41754e1d)
---
.../manager/load/balancer/RouteBalancer.java | 24 ++++++++++++----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
index 144e5a24368..e2f1c6758cc 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
@@ -208,17 +208,19 @@ public class RouteBalancer implements
IClusterStatusSubscriber {
successTransferMap.put(
regionGroupId, new
ConsensusGroupHeartbeatSample(currentTime, newLeaderId));
// Prepare data for flushOldLeader
- lastBalancedOldLeaderId2RegionMap.compute(
- oldLeaderId,
- (k, v) -> {
- if (v == null) {
- List<String> value = new ArrayList<>();
- value.add(String.valueOf(regionGroupId.getId()));
- return value;
- }
- v.add(String.valueOf(regionGroupId.getId()));
- return v;
- });
+ if (oldLeaderId != -1) {
+ lastBalancedOldLeaderId2RegionMap.compute(
+ oldLeaderId,
+ (k, v) -> {
+ if (v == null) {
+ List<String> value = new ArrayList<>();
+ value.add(String.valueOf(regionGroupId.getId()));
+ return value;
+ }
+ v.add(String.valueOf(regionGroupId.getId()));
+ return v;
+ });
+ }
break;
case ConsensusFactory.RATIS_CONSENSUS:
default: