/** * Useful for determining the minimum achieved replication factor across * all shards involved in processing an update request, typically useful * for gauging the replication factor of a batch. */ @SuppressWarnings("rawtypes") public int getMinAchievedReplicationFactor(String collection, NamedList resp) { // it's probably already on the top-level header set by condense NamedList header = (NamedList)resp.get("responseHeader"); Integer achRf = (Integer)header.get(UpdateRequest.REPFACT); if (achRf != null) return achRf.intValue(); // not on the top-level header, walk the shard route tree Map<String,Integer> shardRf = getShardReplicationFactor(collection, resp); for (Integer rf : shardRf.values()) { if (achRf == null || rf < achRf) { achRf = rf; } } return (achRf != null) ? achRf.intValue() : -1; }
/** * Useful for determining the minimum achieved replication factor across * all shards involved in processing an update request, typically useful * for gauging the replication factor of a batch. */ @SuppressWarnings("rawtypes") public int getMinAchievedReplicationFactor(String collection, NamedList resp) { // it's probably already on the top-level header set by condense NamedList header = (NamedList)resp.get("responseHeader"); Integer achRf = (Integer)header.get(UpdateRequest.REPFACT); if (achRf != null) return achRf.intValue(); // not on the top-level header, walk the shard route tree Map<String,Integer> shardRf = getShardReplicationFactor(collection, resp); for (Integer rf : shardRf.values()) { if (achRf == null || rf < achRf) { achRf = rf; } } return (achRf != null) ? achRf.intValue() : -1; }