private String fetchCoreByReplicaSymmetry(Map<String,String> sourceCoreToNodeMap,String sourceCore,String destinationCore){
  if (!sourceCoreToNodeMap.containsKey(sourceCore)) {
    logger.info("Dest core: " + destinationCore + " SrcCore: "+ sourceCore+ " missing in source");
    logger.info("Trying to check for replica asymmetry");
    String[] splits=sourceCore.split("_replica");
    String shardKey=splits[0];
    logger.info("Using " + shardKey + " as the shard key for checking other replicas..");
    String firstReplicaforCurrentShard=shardKey + "_replica1";
    if (!sourceCoreToNodeMap.containsKey(firstReplicaforCurrentShard)) {
      logger.info("No Replica1 exist for this shard... Trying on Replica2 " + firstReplicaforCurrentShard);
      String secondReplicaforCurrentShard=shardKey + "_replica2";
      if (!sourceCoreToNodeMap.containsKey(secondReplicaforCurrentShard)) {
        logger.info("No Replica exists for this shard... Skipping " + secondReplicaforCurrentShard);
      }
 else {
        logger.info("Success finding an Asymetric Replica...");
        logger.info(destinationCore + " is not found on the Source Cluster  but I managed to find another Replica and I am going to use it. Found Replica " + secondReplicaforCurrentShard);
        sourceCore=secondReplicaforCurrentShard;
      }
    }
 else {
      logger.info("Success finding an Asymetric Replica...");
      logger.info(destinationCore + " is not found on the Source Cluster  but I managed to find another Replica and I am going to use it. Found Replica " + firstReplicaforCurrentShard);
      sourceCore=firstReplicaforCurrentShard;
    }
  }
 else {
    logger.info("Found " + sourceCore + "in the source Map itself...");
  }
  return sourceCore;
}

private String fetchCoreByReplicaSymmetry ( Map < String , String > sourceCoreToNodeMap , String sourceCore , String destinationCore ) { if ( ! sourceCoreToNodeMap . containsKey ( sourceCore ) ) { logger . info ( "Dest core: " + destinationCore + " SrcCore: " + sourceCore + " missing in source" ) ; logger . info ( "Trying to check for replica asymmetry" ) ; String [ ] splits = sourceCore . split ( "_replica" ) ; String shardKey = splits [ 0 ] ; logger . info ( "Using " + shardKey + " as the shard key for checking other replicas.." ) ; String firstReplicaforCurrentShard = shardKey + "_replica1" ; if ( ! sourceCoreToNodeMap . containsKey ( firstReplicaforCurrentShard ) ) { logger . info ( "No Replica1 exist for this shard... Trying on Replica2 " + firstReplicaforCurrentShard ) ; String secondReplicaforCurrentShard = shardKey + "_replica2" ; if ( ! sourceCoreToNodeMap . containsKey ( secondReplicaforCurrentShard ) ) { logger . info ( "No Replica exists for this shard... Skipping " + secondReplicaforCurrentShard ) ; } else { logger . info ( "Success finding an Asymetric Replica..." ) ; logger . info ( destinationCore + " is not found on the Source Cluster  but I managed to find another Replica and I am going to use it. Found Replica " + secondReplicaforCurrentShard ) ; sourceCore = secondReplicaforCurrentShard ; } } else { logger . info ( "Success finding an Asymetric Replica..." ) ; logger . info ( destinationCore + " is not found on the Source Cluster  but I managed to find another Replica and I am going to use it. Found Replica " + firstReplicaforCurrentShard ) ; sourceCore = firstReplicaforCurrentShard ; } } else { logger . info ( "Found " + sourceCore + "in the source Map itself..." ) ; } return sourceCore ; }
given the sourcecore to node mapping and destination core , fetch the source core corresponding to it based on replica symmetry < p / > if both source and destination have same number of replicas ( all replica entires are in the map ) , then we can return the source core itself . if certain destination replicas do not have matching source core replicas , then we might have to map the only available source replica to all the destination replicas < p / > example : source collection could have shard1_replica1 and destination might have 2 replicas ( shard1_replica1 , shard2_replica2 ) . this means that we need to still map the one available replica to both the other replicas so that they could be in sync . this is done as follows ( get the shard key < collection > _shard1 and check if replica1 exists in source . if it is available them match all destination replicas for this shard to stream for the only available replica
