diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-07-01 14:40:36 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-07-01 14:40:36 +0000 |
commit | 1ff6b4ff7485f019aade6f429d67f3f22efc46af (patch) | |
tree | 709199686dc0a3f13232bca1509d6edfc48d2d56 /config-model | |
parent | ef585883bc79ab9cbcf6bd9449b8b516e3004510 (diff) |
Test that we feed-sequencer-flag is reflected in proton.indexing.optimize config.
Also handle incorrectly spelled enums by falling back to default.
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java | 10 | ||||
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java | 32 |
2 files changed, 41 insertions, 1 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 de91690cae6..3efc26913a0 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 @@ -177,6 +177,14 @@ public class ContentSearchCluster extends AbstractConfigProducer implements Prot } } + private static ProtonConfig.Indexing.Optimize.Enum convertFeedSequencerType(String sequencerType) { + try { + return ProtonConfig.Indexing.Optimize.Enum.valueOf(sequencerType); + } catch (Throwable t) { + return ProtonConfig.Indexing.Optimize.Enum.LATENCY; + } + } + private ContentSearchCluster(AbstractConfigProducer parent, String clusterName, ModelContext.Properties featureFlags, @@ -191,7 +199,7 @@ public class ContentSearchCluster extends AbstractConfigProducer implements Prot this.globallyDistributedDocuments = globallyDistributedDocuments; this.flushOnShutdown = flushOnShutdown; this.combined = combined; - this.feedSequencerType = ProtonConfig.Indexing.Optimize.Enum.valueOf(featureFlags.feedSequencerType()); + feedSequencerType = convertFeedSequencerType(featureFlags.feedSequencerType()); } public void setVisibilityDelay(double delay) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java index b4fe4175707..5d9b5e3dbce 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java @@ -760,6 +760,38 @@ public class ContentBuilderTest extends DomBuilderTest { } } + private void verifyFeedSequencer(String input, String expceted) { + String hostedXml = "<services>" + + "<content version='1.0' id='search'>" + + " <redundancy>1</redundancy>" + + " <documents>" + + " <document type='music' mode='index'/>" + + " </documents>" + + " <nodes count='1'/>" + + "</content>" + + "</services>"; + + DeployState.Builder deployStateBuilder = new DeployState.Builder().properties(new TestProperties().setFeedSequencerType(input)); + VespaModel model = new VespaModelCreatorWithMockPkg(new MockApplicationPackage.Builder() + .withServices(hostedXml) + .withSearchDefinition(MockApplicationPackage.MUSIC_SEARCHDEFINITION) + .build()) + .create(deployStateBuilder); + ProtonConfig config = getProtonConfig(model.getContentClusters().values().iterator().next()); + assertEquals(expceted, config.indexing().optimize().toString()); + + } + + @Test + public void ensureFeedSequencerIsControlledByFlag() { + verifyFeedSequencer("LATENCY", "LATENCY"); + verifyFeedSequencer("ADAPTIVE", "ADAPTIVE"); + verifyFeedSequencer("THROUGHPUT", "THROUGHPUT"); + verifyFeedSequencer("THOUGHPUT", "LATENCY"); + verifyFeedSequencer("adaptive", "LATENCY"); + + } + @Test public void failWhenNoDocumentsElementSpecified() { expectedException.expect(IllegalArgumentException.class); |