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/08/12 06:28:33 UTC

[iotdb] branch master updated: [IOTDB-4093] Use online DataNodes to allocate new Regions

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

caogaofei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 255320b7fd [IOTDB-4093] Use online DataNodes to allocate new Regions
255320b7fd is described below

commit 255320b7fda51313d98e31fb9fb7c6e1399fb97a
Author: YongzaoDan <33...@users.noreply.github.com>
AuthorDate: Fri Aug 12 14:28:28 2022 +0800

    [IOTDB-4093] Use online DataNodes to allocate new Regions
---
 .../confignode/manager/load/balancer/RegionBalancer.java   | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RegionBalancer.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RegionBalancer.java
index 155dbd4dda..8c92c298fb 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RegionBalancer.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RegionBalancer.java
@@ -29,8 +29,8 @@ import org.apache.iotdb.confignode.exception.NotEnoughDataNodeException;
 import org.apache.iotdb.confignode.exception.StorageGroupNotExistsException;
 import org.apache.iotdb.confignode.manager.ClusterSchemaManager;
 import org.apache.iotdb.confignode.manager.IManager;
-import org.apache.iotdb.confignode.manager.NodeManager;
 import org.apache.iotdb.confignode.manager.PartitionManager;
+import org.apache.iotdb.confignode.manager.load.LoadManager;
 import org.apache.iotdb.confignode.manager.load.balancer.region.CopySetRegionAllocator;
 import org.apache.iotdb.confignode.manager.load.balancer.region.GreedyRegionAllocator;
 import org.apache.iotdb.confignode.manager.load.balancer.region.IRegionAllocator;
@@ -68,9 +68,7 @@ public class RegionBalancer {
     CreateRegionGroupsPlan createRegionGroupsPlan = new CreateRegionGroupsPlan();
     IRegionAllocator regionAllocator = genRegionAllocator();
 
-    // TODO: After waiting for the IT framework to complete, change the following code to:
-    //  List<TDataNodeInfo> onlineDataNodes = getLoadManager().getOnlineDataNodes(-1);
-    List<TDataNodeConfiguration> registeredDataNodes = getNodeManager().getRegisteredDataNodes();
+    List<TDataNodeConfiguration> onlineDataNodes = getLoadManager().getOnlineDataNodes();
     List<TRegionReplicaSet> allocatedRegions = getPartitionManager().getAllReplicaSets();
 
     for (Map.Entry<String, Integer> entry : allotmentMap.entrySet()) {
@@ -86,7 +84,7 @@ public class RegionBalancer {
               : storageGroupSchema.getDataReplicationFactor();
 
       // Check validity
-      if (registeredDataNodes.size() < replicationFactor) {
+      if (onlineDataNodes.size() < replicationFactor) {
         throw new NotEnoughDataNodeException();
       }
 
@@ -94,7 +92,7 @@ public class RegionBalancer {
         // Generate allocation plan
         TRegionReplicaSet newRegion =
             regionAllocator.allocateRegion(
-                registeredDataNodes,
+                onlineDataNodes,
                 allocatedRegions,
                 replicationFactor,
                 new TConsensusGroupId(
@@ -122,8 +120,8 @@ public class RegionBalancer {
     }
   }
 
-  private NodeManager getNodeManager() {
-    return configManager.getNodeManager();
+  private LoadManager getLoadManager() {
+    return configManager.getLoadManager();
   }
 
   private ClusterSchemaManager getClusterSchemaManager() {