private boolean shouldMirrorCommit()

in crossdc-producer/src/main/java/org/apache/solr/update/processor/MirroringUpdateProcessor.java [304:326]


  private boolean shouldMirrorCommit(SolrQueryRequest req) {
    CloudDescriptor cd = req.getCore().getCoreDescriptor().getCloudDescriptor();
    if (cd != null) {
      String shardId = cd.getShardId();
      ClusterState clusterState =
          req.getCore().getCoreContainer().getZkController().getClusterState();
      DocCollection coll = clusterState.getCollection(cd.getCollectionName());
      String firstShard = new TreeMap<>(coll.getSlicesMap()).keySet().iterator().next();
      if (!shardId.equals(firstShard)) {
        return false;
      }
      Replica leaderReplica;
      try {
        leaderReplica = req.getCore().getCoreContainer().getZkController().getZkStateReader().getLeaderRetry(cd.getCollectionName(), shardId);
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "", e);
      }
      return leaderReplica.getName().equals(cd.getCoreNodeName());
    } else {
      return false;
    }
  }