Class RemoveDataNodeHandler
java.lang.Object
org.apache.iotdb.confignode.procedure.env.RemoveDataNodeHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbroadcastDataNodeStatusChange(List<TDataNodeLocation> dataNodes) Broadcasts DataNodes' status change, preventing disabled DataNodes from accepting read or write requests.voidchangeDataNodeStatus(List<TDataNodeLocation> removedDataNodes, Map<Integer, NodeStatus> nodeStatusMap) Changes the status of a batch of specified DataNodes to the given status.checkAllowRemoveDataNodes(RemoveDataNodePlan removeDataNodePlan) Checks if it is allowed to remove the specified DataNodes from the cluster.booleancheckEnoughDataNodeAfterRemoving(List<TDataNodeLocation> removedDataNodes) Check if the data nodes are sufficient after removing.checkRegionReplication(RemoveDataNodePlan removeDataNodePlan) Checks whether the cluster has enough DataNodes to maintain the required number of RegionReplicas.checkRemoveDataNodeRequest(RemoveDataNodePlan removeDataNodePlan) Checks if the RemoveDataNode request is valid.getMigratedDataNodeRegions(TDataNodeLocation removedDataNode) Retrieves all consensus group IDs from the specified DataNode.getRegionMigrationPlans(List<TDataNodeLocation> removedDataNodes) Retrieves all region migration plans for the specified removed DataNodes.getRelatedDataNodeLocations(TDataNodeLocation removedDataNode) Retrieves all DataNodes related to the specified DataNode.getRemovedDataNodesRegionSet(List<TDataNodeLocation> removedDataNodes) Retrieves all consensus group IDs from the specified removed DataNodes.voidremoveDataNodePersistence(List<TDataNodeLocation> removedDataNodes) Removes a batch of DataNodes from the node information.voidstopDataNodes(List<TDataNodeLocation> removedDataNodes) Stops the specified old DataNodes.
-
Constructor Details
-
RemoveDataNodeHandler
-
-
Method Details
-
checkEnoughDataNodeAfterRemoving
Check if the data nodes are sufficient after removing.- Parameters:
removedDataNodes- List- Returns:
- true if the number of DataNodes is enough, false otherwise
-
changeDataNodeStatus
public void changeDataNodeStatus(List<TDataNodeLocation> removedDataNodes, Map<Integer, NodeStatus> nodeStatusMap) Changes the status of a batch of specified DataNodes to the given status. This is done to prevent the DataNodes from receiving read or write requests when they are being removed or are in a restricted state.- Parameters:
removedDataNodes- the locations of the DataNodes whose statuses need to be changednodeStatusMap- a map containing the new status to assign to each DataNode (e.g., Removing, Running, etc.)
-
getRegionMigrationPlans
Retrieves all region migration plans for the specified removed DataNodes.- Parameters:
removedDataNodes- the list of DataNodes from which to obtain migration plans- Returns:
- a list of region migration plans associated with the removed DataNodes
-
broadcastDataNodeStatusChange
Broadcasts DataNodes' status change, preventing disabled DataNodes from accepting read or write requests.- Parameters:
dataNodes- the list of DataNodes that require broadcast status changes
-
removeDataNodePersistence
Removes a batch of DataNodes from the node information.- Parameters:
removedDataNodes- the list of DataNodeLocations to be removed
-
stopDataNodes
Stops the specified old DataNodes.- Parameters:
removedDataNodes- the list of DataNodeLocations to be stopped
-
checkRemoveDataNodeRequest
Checks if the RemoveDataNode request is valid.- Parameters:
removeDataNodePlan- the RemoveDataNodeReq to be validated- Returns:
- SUCCEED_STATUS if the request is valid
-
checkRegionReplication
Checks whether the cluster has enough DataNodes to maintain the required number of RegionReplicas.- Parameters:
removeDataNodePlan- the RemoveDataNodeReq to be evaluated- Returns:
- SUCCEED_STATUS if the number of DataNodes is sufficient, LACK_REPLICATION otherwise
-
checkAllowRemoveDataNodes
Checks if it is allowed to remove the specified DataNodes from the cluster.- Parameters:
removeDataNodePlan- the RemoveDataNodeReq to be evaluated- Returns:
- SUCCEED_STATUS if the request is valid, otherwise an appropriate error status
-
getRemovedDataNodesRegionSet
public Set<TConsensusGroupId> getRemovedDataNodesRegionSet(List<TDataNodeLocation> removedDataNodes) Retrieves all consensus group IDs from the specified removed DataNodes.- Parameters:
removedDataNodes- the list of removed DataNodes- Returns:
- a set of TConsensusGroupId representing the consensus groups associated with the removed DataNodes
-
getMigratedDataNodeRegions
Retrieves all consensus group IDs from the specified DataNode.- Parameters:
removedDataNode- the DataNode to be removed- Returns:
- a list of group IDs that need to be migrated
-
getRelatedDataNodeLocations
Retrieves all DataNodes related to the specified DataNode.- Parameters:
removedDataNode- the DataNode to be removed- Returns:
- a set of TDataNodeLocation representing the DataNodes associated with the specified DataNode
-