void addPartition(PartitionId partitionId) {
    try {
      rwLock.writeLock().lock();
      if (partitionToPartitionInfo.containsKey(partitionId)) {
        vcrMetrics.addPartitionErrorCount.inc();
        logger.warn("Partition {} already exists", partitionId.getId());
        return;
      }
      ReplicaId cloudReplica = new CloudReplica(partitionId, vcrClusterParticipant.getCurrentDataNodeId());
      List<? extends ReplicaId> peerReplicas = cloudReplica.getPeerReplicaIds();
      if (peerReplicas == null || peerReplicas.size() == 0) {
        vcrMetrics.addPartitionErrorCount.inc();
        logger.error("No peer replicas for {}", partitionId.getId());
        return;
      }
      List<RemoteReplicaInfo> remoteReplicaInfos = new ArrayList<>();
      if (!storeManager.addBlobStore(cloudReplica)) {
        vcrMetrics.addPartitionErrorCount.inc();
        logger.error("Failed to add Store for partition {}", partitionId.getId());
        return;
      }
      Store store = storeManager.getStore(partitionId);
      for (ReplicaId peerReplica : peerReplicas) {
        if (peerReplica.getDataNodeId().getDatacenterName().equalsIgnoreCase(localDatacenterName)) {
          remoteReplicaInfos.add(createRemoteReplica(peerReplica, cloudReplica, store, null));
        }
      }
      if (!remoteReplicaInfos.isEmpty()) {
        updatePartitionInfoMaps(remoteReplicaInfos, cloudReplica);
        addPartitionToReplicaThread(partitionId, remoteReplicaInfos);
      }
    } catch (Throwable e) {
      // Helix will run into error state if exception throws in Helix context.
      vcrMetrics.addPartitionErrorCount.inc();
      logger.error("Failed to add partition {} due to {}", partitionId.getId(), e);
    } finally {
      rwLock.writeLock().unlock();
    }
  }
Add a replica of given {@link PartitionId} and its {@link RemoteReplicaInfo}s to backup list.
@param partitionId the {@link PartitionId} of the replica to add.
@throws ReplicationException if replicas initialization failed.
ambry-cloud/src/main/java/com/github/ambry/cloud/VcrReplicationManager.java