summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-09-28 21:31:54 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2016-09-28 21:31:54 +0200
commit241927feefb46cc3cffd43e4738cd1c3a6bfc40f (patch)
tree2307f86cd65d95da78b2cbffb5d41cc0589b7666 /config-model
parent9824a0043bfd5e4fb636bdd37d91ce75be506e99 (diff)
Produce redundancy config for proton too.
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java5
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/Redundancy.java11
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/ClusterTest.java21
3 files changed, 29 insertions, 8 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 56e275e74ac..7e24285c6fb 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
@@ -31,6 +31,7 @@ public class ContentSearchCluster extends AbstractConfigProducer implements Prot
/** The single, indexed search cluster this sets up (supporting multiple document types), or null if none */
private IndexedSearchCluster indexedCluster;
+ private Redundancy redundancy;
private final String clusterName;
Map<String, NewDocumentType> documentDefinitions;
@@ -254,6 +255,7 @@ public class ContentSearchCluster extends AbstractConfigProducer implements Prot
if (usesHierarchicDistribution()) {
indexedCluster.setMaxNodesDownPerFixedRow((redundancy.effectiveFinalRedundancy() / groupToSpecMap.size()) - 1);
}
+ this.redundancy = redundancy;
}
@Override
@@ -287,6 +289,9 @@ public class ContentSearchCluster extends AbstractConfigProducer implements Prot
if (tuning != null) {
tuning.getConfig(builder);
}
+ if (redundancy != null) {
+ redundancy.getConfig(builder);
+ }
}
@Override
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/Redundancy.java b/config-model/src/main/java/com/yahoo/vespa/model/content/Redundancy.java
index 262c985e733..8b6dfbdcd6e 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/Redundancy.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/Redundancy.java
@@ -2,13 +2,14 @@
package com.yahoo.vespa.model.content;
import com.yahoo.vespa.config.content.StorDistributionConfig;
+import com.yahoo.vespa.config.search.core.ProtonConfig;
/**
* Configuration of the redundancy of a content cluster.
*
* @author bratseth
*/
-public class Redundancy implements StorDistributionConfig.Producer {
+public class Redundancy implements StorDistributionConfig.Producer, ProtonConfig.Producer {
private final int initialRedundancy ;
private final int finalRedundancy;
@@ -54,4 +55,12 @@ public class Redundancy implements StorDistributionConfig.Producer {
builder.redundancy(effectiveFinalRedundancy());
builder.ready_copies(effectiveReadyCopies());
}
+ @Override
+ public void getConfig(ProtonConfig.Builder builder) {
+ ProtonConfig.Distribution.Builder distBuilder = new ProtonConfig.Distribution.Builder();
+ distBuilder.redundancy(finalRedundancy);
+ distBuilder.searchablecopies(readyCopies);
+ builder.distribution(distBuilder);
+
+ }
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterTest.java
index bcb113687ec..106607f7150 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterTest.java
@@ -9,6 +9,7 @@ import com.yahoo.vespa.config.content.core.StorServerConfig;
import com.yahoo.vespa.config.content.FleetcontrollerConfig;
import com.yahoo.vespa.config.content.StorDistributionConfig;
import com.yahoo.metrics.MetricsmanagerConfig;
+import com.yahoo.vespa.config.search.core.ProtonConfig;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.content.cluster.ContentCluster;
@@ -35,8 +36,7 @@ public class ClusterTest extends ContentBaseTest {
@Test
public void testRedundancy() {
- StorDistributionConfig.Builder builder = new StorDistributionConfig.Builder();
- parse("" +
+ ContentCluster cc = parse("" +
"<content version=\"1.0\" id=\"storage\">\n" +
" <documents/>" +
" <engine>" +
@@ -53,12 +53,19 @@ public class ClusterTest extends ContentBaseTest {
" <node hostalias=\"mockhost\" distribution-key=\"4\"/>\"" +
" </group>" +
"</content>"
- ).getConfig(builder);
+ );
+ StorDistributionConfig.Builder storBuilder = new StorDistributionConfig.Builder();
+ cc.getConfig(storBuilder);
+ StorDistributionConfig storConfig = new StorDistributionConfig(storBuilder);
+ assertEquals(4, storConfig.initial_redundancy());
+ assertEquals(5, storConfig.redundancy());
+ assertEquals(3, storConfig.ready_copies());
+ ProtonConfig.Builder protonBuilder = new ProtonConfig.Builder();
+ cc.getSearch().getConfig(protonBuilder);
+ ProtonConfig protonConfig = new ProtonConfig(protonBuilder);
+ assertEquals(3, protonConfig.distribution().searchablecopies());
+ assertEquals(5, protonConfig.distribution().redundancy());
- StorDistributionConfig config = new StorDistributionConfig(builder);
- assertEquals(4, config.initial_redundancy());
- assertEquals(5, config.redundancy());
- assertEquals(3, config.ready_copies());
}
@Test