use of com.yahoo.vespa.model.content.Redundancy in project vespa by vespa-engine.
the class RedundancyBuilder method build.
Redundancy build(ModelElement clusterXml) {
Integer initialRedundancy = 2;
Integer finalRedundancy = 3;
Integer readyCopies = 2;
ModelElement redundancyElement = clusterXml.getChild("redundancy");
if (redundancyElement != null) {
initialRedundancy = redundancyElement.getIntegerAttribute("reply-after");
finalRedundancy = (int) redundancyElement.asLong();
if (initialRedundancy == null) {
initialRedundancy = finalRedundancy;
} else {
if (finalRedundancy < initialRedundancy) {
throw new IllegalArgumentException("Final redundancy must be higher than or equal to initial redundancy");
}
}
readyCopies = clusterXml.childAsInteger("engine.proton.searchable-copies");
if (readyCopies == null) {
readyCopies = Math.min(finalRedundancy, 2);
}
if (readyCopies > finalRedundancy) {
throw new IllegalArgumentException("Number of searchable copies can not be higher than final redundancy");
}
}
return new Redundancy(initialRedundancy, finalRedundancy, readyCopies);
}
Aggregations