public static ReplicaMetadataRequest readFrom(DataInputStream stream, ClusterMap clusterMap,
      FindTokenHelper findTokenHelper) throws IOException {
    Short versionId = stream.readShort();
    validateVersion(versionId);
    int correlationId = stream.readInt();
    String clientId = Utils.readIntString(stream);
    int replicaMetadataRequestInfoListCount = stream.readInt();
    ArrayList<ReplicaMetadataRequestInfo> replicaMetadataRequestInfoList =
        new ArrayList<ReplicaMetadataRequestInfo>(replicaMetadataRequestInfoListCount);
    for (int i = 0; i < replicaMetadataRequestInfoListCount; i++) {
      ReplicaMetadataRequestInfo replicaMetadataRequestInfo =
          ReplicaMetadataRequestInfo.readFrom(stream, clusterMap, findTokenHelper, versionId);
      replicaMetadataRequestInfoList.add(replicaMetadataRequestInfo);
    }
    long maxTotalSizeOfEntries = stream.readLong();
    // ignore version for now
    return new ReplicaMetadataRequest(correlationId, clientId, replicaMetadataRequestInfoList, maxTotalSizeOfEntries,
        versionId);
  }
Replica metadata request to get new entries for replication
ambry-protocol/src/main/java/com/github/ambry/protocol/ReplicaMetadataRequest.java