public TSStatus createNewRegionPeer(TConsensusGroupId regionId, TDataNodeLocation destDataNode) {
    TSStatus status;
    List<TDataNodeLocation> regionReplicaNodes = findRegionLocations(regionId);
    if (regionReplicaNodes.isEmpty()) {
      LOGGER.warn(
          "{}, Cannot find region replica nodes in createPeer, regionId: {}",
          REGION_MIGRATE_PROCESS,
          regionId);
      status = new TSStatus(TSStatusCode.MIGRATE_REGION_ERROR.getStatusCode());
      status.setMessage("Not find region replica nodes in createPeer, regionId: " + regionId);
      return status;
    }

    List<TDataNodeLocation> currentPeerNodes;
    if (TConsensusGroupType.DataRegion.equals(regionId.getType())
        && (IOT_CONSENSUS.equals(CONF.getDataRegionConsensusProtocolClass())
            || IOT_CONSENSUS_V2.equals(CONF.getDataRegionConsensusProtocolClass()))) {
      // parameter of createPeer for MultiLeader should be all peers
      currentPeerNodes = new ArrayList<>(regionReplicaNodes);
      currentPeerNodes.add(destDataNode);
    } else {
      // parameter of createPeer for Ratis can be empty
      currentPeerNodes = Collections.emptyList();
    }

    String database = configManager.getPartitionManager().getRegionDatabase(regionId);
    TCreatePeerReq req = new TCreatePeerReq(regionId, currentPeerNodes, database);

    status =
        (TSStatus)
            SyncDataNodeClientPool.getInstance()
                .sendSyncRequestToDataNodeWithRetry(
                    destDataNode.getInternalEndPoint(),
                    req,
                    CnToDnSyncRequestType.CREATE_NEW_REGION_PEER);

    if (isSucceed(status)) {
      LOGGER.info(
          "{}, Send action createNewRegionPeer finished, regionId: {}, newPeerDataNodeId: {}",
          REGION_MIGRATE_PROCESS,
          regionId,
          getIdWithRpcEndpoint(destDataNode));
    } else {
      LOGGER.error(
          "{}, Send action createNewRegionPeer error, regionId: {}, newPeerDataNodeId: {}, result: {}",
          REGION_MIGRATE_PROCESS,
          regionId,
          getIdWithRpcEndpoint(destDataNode),
          status);
    }

    return status;
  }
Create a new RegionReplica and build the ConsensusGroup on the destined DataNode

<p>createNewRegionPeer should be invoked on a DataNode that doesn't contain any peer of the
specific ConsensusGroup, in order to avoid there exists one DataNode who has more than one
RegionReplica.

@param regionId The given ConsensusGroup
@param destDataNode The destined DataNode where the new peer will be created
@return status
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/RegionMaintainHandler.java