diff options
5 files changed, 25 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java index a74cb040631..daade2d74d9 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java @@ -322,8 +322,12 @@ public class ContentSearchCluster extends AbstractConfigProducer<SearchCluster> } public void handleRedundancy(Redundancy redundancy) { - if (hasIndexedCluster()) + if (hasIndexedCluster()) { + // Important: these must all be the normalized "within a single leaf group" values, + // _not_ the cluster-wide, cross-group values. indexedCluster.setSearchableCopies(redundancy.readyCopies()); + indexedCluster.setRedundancy(redundancy.finalRedundancy()); + } this.redundancy = redundancy; } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroup.java b/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroup.java index d9eddc1a548..643a305f369 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroup.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroup.java @@ -54,6 +54,8 @@ public class DispatchGroup { public int getSearchableCopies() { return sc.getSearchableCopies(); } + public int getRedundancy() { return sc.getRedundancy(); } + static class Iterator implements java.util.Iterator<SearchInterface> { private java.util.Iterator<Map<Integer, SearchInterface>> it1; diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java index 56fb915797b..a3ee8d56142 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java @@ -54,6 +54,7 @@ public class IndexedSearchCluster extends SearchCluster private final MultipleDocumentDatabasesConfigProducer documentDbsConfigProducer; private int searchableCopies = 1; + private int redundancy = 1; private final DispatchGroup rootDispatch; private DispatchSpec dispatchSpec; @@ -263,6 +264,14 @@ public class IndexedSearchCluster extends SearchCluster this.searchableCopies = searchableCopies; } + public int getRedundancy() { + return redundancy; + } + + public void setRedundancy(int redundancy) { + this.redundancy = redundancy; + } + public void setDispatchSpec(DispatchSpec dispatchSpec) { if (dispatchSpec.getNumDispatchGroups() != null) { this.dispatchSpec = new DispatchSpec.Builder().setGroups @@ -310,6 +319,7 @@ public class IndexedSearchCluster extends SearchCluster builder.maxHitsPerNode(tuning.dispatch.getMaxHitsPerPartition()); builder.searchableCopies(rootDispatch.getSearchableCopies()); + builder.redundancy(rootDispatch.getRedundancy()); if (searchCoverage != null) { if (searchCoverage.getMinimum() != null) builder.minSearchCoverage(searchCoverage.getMinimum() * 100.0); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java index 1104ac7477a..764e56c1bba 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java @@ -63,6 +63,7 @@ public class ClusterTest { assertEquals(0.23, config.minWaitAfterCoverageFactor(), DELTA); assertEquals(0.58, config.maxWaitAfterCoverageFactor(), DELTA); assertEquals(2, config.searchableCopies()); + assertEquals(3, config.redundancy()); assertEquals(DispatchConfig.DistributionPolicy.ADAPTIVE, config.distributionPolicy()); } @@ -80,6 +81,7 @@ public class ClusterTest { cluster.getSearch().getConfig(builder); DispatchConfig config = new DispatchConfig(builder); assertEquals(2, config.searchableCopies()); + assertEquals(3, config.redundancy()); assertEquals(93.0, config.minActivedocsPercentage(), DELTA); assertEquals(DispatchConfig.DistributionPolicy.ROUNDROBIN, config.distributionPolicy()); assertEquals(77, config.maxHitsPerNode()); @@ -94,6 +96,7 @@ public class ClusterTest { cluster.getSearch().getConfig(builder); DispatchConfig config = new DispatchConfig(builder); assertEquals(2, config.searchableCopies()); + assertEquals(3, config.redundancy()); assertEquals(DispatchConfig.DistributionPolicy.ADAPTIVE, config.distributionPolicy()); assertEquals(1.0, config.maxWaitAfterCoverageFactor(), DELTA); assertEquals(0, config.minWaitAfterCoverageFactor(), DELTA); diff --git a/configdefinitions/src/vespa/dispatch.def b/configdefinitions/src/vespa/dispatch.def index e26a136d245..9addfca1559 100644 --- a/configdefinitions/src/vespa/dispatch.def +++ b/configdefinitions/src/vespa/dispatch.def @@ -33,9 +33,13 @@ useMultilevelDispatch bool default=false # Dispatch only to local nodes. DEPRECATED: The container will automatically do this when it is appropriate. useLocalNode bool default=false -# Number of document copies +# Number of document replicas _per group_ that will be indexed in a stable cluster. searchableCopies long default=1 +# Number of document replicas _per group_ that will be present in a stable cluster. +# Should always be >= searchableCopies. +redundancy long default=1 + # Minimum search coverage required before returning the results of a query minSearchCoverage double default=100 |