GetRequest createGetRequest(List<RemoteReplicaInfo> replicasToReplicatePerNode,
      List<ExchangeMetadataResponse> exchangeMetadataResponseList, DataNodeId remoteNode) {
    List<PartitionRequestInfo> partitionRequestInfoList = new ArrayList<>();
    for (int i = 0; i < exchangeMetadataResponseList.size(); i++) {
      ExchangeMetadataResponse exchangeMetadataResponse = exchangeMetadataResponseList.get(i);
      RemoteReplicaInfo remoteReplicaInfo = replicasToReplicatePerNode.get(i);
      if (exchangeMetadataResponse.serverErrorCode == ServerErrorCode.NoError) {
        Set<StoreKey> missingStoreKeys = exchangeMetadataResponse.getMissingStoreKeys();
        if (missingStoreKeys.size() > 0) {
          if (remoteNode instanceof CloudDataNode) {
            logger.trace("Replicating blobs from CloudDataNode: {}", missingStoreKeys);
          }
          ArrayList<BlobId> keysToFetch = new ArrayList<>();
          for (StoreKey storeKey : missingStoreKeys) {
            keysToFetch.add((BlobId) storeKey);
          }
          PartitionRequestInfo partitionRequestInfo =
              new PartitionRequestInfo(remoteReplicaInfo.getReplicaId().getPartitionId(), keysToFetch);
          partitionRequestInfoList.add(partitionRequestInfo);
        }
      }
    }
    if (!partitionRequestInfoList.isEmpty()) {
      return new GetRequest(correlationIdGenerator.incrementAndGet(),
          GetRequest.Replication_Client_Id_Prefix + dataNodeId.getHostname() + "[" + dataNodeId.getDatacenterName()
              + "]", MessageFormatFlags.All, partitionRequestInfoList,
          replicationConfig.replicationIncludeAll ? GetOption.Include_All : GetOption.None);
    }
    return null;
  }
Create a {@link GetRequest} for the given replica ids in the list of {@link RemoteReplicaInfo}.
@param replicasToReplicatePerNode The list of {@link RemoteReplicaInfo} that contains the remote replica ids and their tokens.
@param exchangeMetadataResponseList The list of {@link ExchangeMetadataResponse} that contains missing keys for each partitions.
@param remoteNode The remote {@link DataNodeId}.
@return A {@link GetRequest} that contains all the missing keys.
ambry-replication/src/main/java/com/github/ambry/replication/ReplicaThread.java