diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-11-21 14:05:14 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2018-11-21 14:05:14 +0100 |
commit | e11a83c9bd353b056acb0dd08d44e8f84f8cdc9e (patch) | |
tree | 1756ae62d4fa74153fcfaf909e272d12f773f1fe /config-model | |
parent | 18e7977064d2266209248399536d91fc742d5aba (diff) |
Control dispatch policy explicit
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/search/Dispatch.java | 10 | ||||
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java | 27 |
2 files changed, 35 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/Dispatch.java b/config-model/src/main/java/com/yahoo/vespa/model/search/Dispatch.java index 078fdf87c31..ada1396cc62 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/Dispatch.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/Dispatch.java @@ -7,6 +7,7 @@ import com.yahoo.config.model.producer.AbstractConfigProducer; import com.yahoo.vespa.model.AbstractService; import com.yahoo.vespa.model.application.validation.RestartConfigs; import com.yahoo.vespa.model.content.SearchCoverage; +import com.yahoo.vespa.model.content.TuningDispatch; import java.util.ArrayList; import java.util.List; @@ -31,6 +32,7 @@ public class Dispatch extends AbstractService implements SearchInterface, private final int dispatchLevel; private final boolean preferLocalRow; private final boolean isTopLevel; + private TuningDispatch.DispatchPolicy dispatchPolicy = TuningDispatch.DispatchPolicy.ROUNDROBIN; private Dispatch(DispatchGroup dispatchGroup, AbstractConfigProducer parent, String subConfigId, NodeSpec nodeSpec, int dispatchLevel, boolean preferLocalRow, boolean isTopLevel) { @@ -48,6 +50,11 @@ public class Dispatch extends AbstractService implements SearchInterface, .setProp("index", nodeSpec.groupIndex()); } + public Dispatch setDispatchPolicy(TuningDispatch.DispatchPolicy dispatchPolicy) { + this.dispatchPolicy = dispatchPolicy; + return this; + } + public static Dispatch createTld(DispatchGroup dispatchGroup, AbstractConfigProducer parent, int rowId) { return createTld(dispatchGroup, parent, rowId, false); } @@ -133,7 +140,8 @@ public class Dispatch extends AbstractService implements SearchInterface, refcost(1). rowbits(rowbits). numparts(dispatchGroup.getNumPartitions()). - mpp(dispatchGroup.getMinNodesPerColumn()); + mpp(dispatchGroup.getMinNodesPerColumn()). + useroundrobinforfixedrow(dispatchPolicy == TuningDispatch.DispatchPolicy.ROUNDROBIN); if (dispatchGroup.useFixedRowInDispatch()) { datasetBuilder.querydistribution(PartitionsConfig.Dataset.Querydistribution.Enum.FIXEDROW); datasetBuilder.maxnodesdownperfixedrow(dispatchGroup.getMaxNodesDownPerFixedRow()); 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 b4994e5d009..645ab71bcb4 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 @@ -20,6 +20,7 @@ import java.util.List; import static com.yahoo.config.model.test.TestUtil.joinLines; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; /** * @author Simon Thoresen Hult @@ -57,6 +58,21 @@ public class ClusterTest { assertEquals(0.23, config.dataset(0).higher_coverage_minsearchwait(), 1E-6); assertEquals(0.58, config.dataset(0).higher_coverage_maxsearchwait(), 1E-6); assertEquals(2, config.dataset(0).searchablecopies()); + assertTrue(config.dataset(0).useroundrobinforfixedrow()); + } + } + + @Test + public void requireThatDispatchTuningIsApplied() throws ParseException { + ContentCluster cluster = newContentCluster(joinLines("<search>", "</search>"), + joinLines("<tuning>", + "</tuning>")); + for (Dispatch tld : cluster.getSearch().getIndexed().getTLDs()) { + PartitionsConfig.Builder builder = new PartitionsConfig.Builder(); + tld.getConfig(builder); + PartitionsConfig config = new PartitionsConfig(builder); + assertEquals(2, config.dataset(0).searchablecopies()); + assertTrue(config.dataset(0).useroundrobinforfixedrow()); } } @@ -70,10 +86,18 @@ public class ClusterTest { } private static ContentCluster newContentCluster(String contentSearchXml) throws ParseException { - return newContentCluster(contentSearchXml, false); + return newContentCluster(contentSearchXml, "", false); + } + + private static ContentCluster newContentCluster(String contentSearchXml, String searchNodeTuningXml) throws ParseException { + return newContentCluster(contentSearchXml, searchNodeTuningXml, false); } private static ContentCluster newContentCluster(String contentSearchXml, boolean globalDocType) throws ParseException { + return newContentCluster(contentSearchXml, "", globalDocType); + } + + private static ContentCluster newContentCluster(String contentSearchXml, String searchNodeTuningXml, boolean globalDocType) throws ParseException { ApplicationPackage app = new MockApplicationPackage.Builder() .withHosts(joinLines("<hosts>", " <host name='localhost'><alias>my_host</alias></host>", @@ -90,6 +114,7 @@ public class ClusterTest { " <engine>", " <proton>", " <searchable-copies>2</searchable-copies>", + searchNodeTuningXml, " </proton>", " </engine>", " <group>", |