HxpSerein commented on code in PR #13559:
URL: https://github.com/apache/iotdb/pull/13559#discussion_r1776315538


##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/node/RemoveDataNodesProcedure.java:
##########
@@ -38,82 +40,89 @@
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
 import static 
org.apache.iotdb.confignode.conf.ConfigNodeConstant.REMOVE_DATANODE_PROCESS;
 
 /** remove data node procedure */
-public class RemoveDataNodeProcedure extends 
AbstractNodeProcedure<RemoveDataNodeState> {
-  private static final Logger LOG = 
LoggerFactory.getLogger(RemoveDataNodeProcedure.class);
+public class RemoveDataNodesProcedure extends 
AbstractNodeProcedure<RemoveDataNodeState> {
+  private static final Logger LOG = 
LoggerFactory.getLogger(RemoveDataNodesProcedure.class);
   private static final int RETRY_THRESHOLD = 5;
 
-  private TDataNodeLocation removedDataNode;
+  private List<TDataNodeLocation> removedDataNodes;
 
-  private List<TConsensusGroupId> migratedDataNodeRegions = new ArrayList<>();
+  private List<RegionMigrationPlan> regionMigrationPlans = new ArrayList<>();
 
-  public RemoveDataNodeProcedure() {
+  private Map<Integer, NodeStatus> nodeStatusMap;
+
+  public RemoveDataNodesProcedure() {
     super();
   }
 
-  public RemoveDataNodeProcedure(TDataNodeLocation removedDataNode) {
+  public RemoveDataNodesProcedure(
+      List<TDataNodeLocation> removedDataNodes, Map<Integer, NodeStatus> 
nodeStatusMap) {
     super();
-    this.removedDataNode = removedDataNode;
+    this.removedDataNodes = removedDataNodes;
+    this.nodeStatusMap = nodeStatusMap;
   }
 
   @Override
   protected Flow executeFromState(ConfigNodeProcedureEnv env, 
RemoveDataNodeState state) {
-    if (removedDataNode == null) {
+    if (removedDataNodes.isEmpty()) {
       return Flow.NO_MORE_STATE;
     }
 
-    RegionMaintainHandler handler = env.getRegionMaintainHandler();
+    RemoveDataNodeManager manager = env.getRemoveDataNodeManager();
     try {
       switch (state) {
         case REGION_REPLICA_CHECK:
-          if (env.checkEnoughDataNodeAfterRemoving(removedDataNode)) {
+          if (manager.checkEnoughDataNodeAfterRemoving(removedDataNodes)) {

Review Comment:
   this is a double check



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to