private TSStatus checkReconstructRegion(
      TReconstructRegionReq req,
      TConsensusGroupId regionId,
      TDataNodeLocation targetDataNode,
      TDataNodeLocation coordinator) {
    String failMessage =
        regionOperationCommonCheck(
            regionId,
            targetDataNode,
            Arrays.asList(
                new Pair<>("Target DataNode", targetDataNode),
                new Pair<>("Coordinator", coordinator)),
            req.getModel());

    ConfigNodeConfig conf = ConfigNodeDescriptor.getInstance().getConf();
    if (configManager
            .getPartitionManager()
            .getAllReplicaSetsMap(regionId.getType())
            .get(regionId)
            .getDataNodeLocationsSize()
        == 1) {
      failMessage = String.format("%s only has 1 replica, it cannot be reconstructed", regionId);
    } else if (configManager
        .getPartitionManager()
        .getAllReplicaSets(targetDataNode.getDataNodeId())
        .stream()
        .noneMatch(replicaSet -> replicaSet.getRegionId().equals(regionId))) {
      failMessage =
          String.format(
              "Submit ReconstructRegionProcedure failed, because the target DataNode %s doesn't contain Region %s",
              req.getDataNodeId(), regionId);
    }

    if (failMessage != null) {
      LOGGER.warn(failMessage);
      TSStatus failStatus = new TSStatus(TSStatusCode.RECONSTRUCT_REGION_ERROR.getStatusCode());
      failStatus.setMessage(failMessage);
      return failStatus;
    }
    return new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
  }
Checks whether region migration is allowed.

@param migrateRegionReq the migration request details
@param regionGroupId the ID of the consensus group for the region
@param originalDataNode the original DataNode location from which the region is being migrated
@param destDataNode the destination DataNode location to which the region is being migrated
@param coordinatorForAddPeer the DataNode location acting as the coordinator for adding a peer
@return the status of the migration request (TSStatus)
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java