diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-06-01 16:11:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-01 16:11:07 +0200 |
commit | c9bd5bf0a8975ff0b187393b87720e07c6619ff9 (patch) | |
tree | e357bb58134def276b89533b3468ad1f5fd75920 | |
parent | 857e7f68c57893c23202db4bc4baff5679a50b08 (diff) | |
parent | f5a21748a6a41690e9074e8b183f1f3277c9815f (diff) |
Merge pull request #27223 from vespa-engine/balder/tuning-support-for-lidspace-bloat-factor
Add support for tuning lidspace bloat-factor in services.xml.
4 files changed, 39 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomSearchTuningBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomSearchTuningBuilder.java index d9ef5fd2123..64592e75c41 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomSearchTuningBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomSearchTuningBuilder.java @@ -66,10 +66,22 @@ public class DomSearchTuningBuilder extends VespaDomBuilder.DomConfigProducerBui handleFeeding(e, t.searchNode); } else if (equals("removed-db", e)) { handleRemovedDB(e, t.searchNode); + } else if (equals("lidspace", e)) { + handleLidSpace(e, t.searchNode); } } } + private void handleLidSpace(Element spec, Tuning.SearchNode t) { + t.lidSpace = new Tuning.SearchNode.LidSpace(); + for (Element e : XML.getChildren(spec)) { + if (equals("max-bloat-factor", e)) { + t.lidSpace.bloatFactor = asDouble(e); + } + } + + } + private void handleRequestThreads(Element spec, Tuning.SearchNode sn) { sn.threads = new Tuning.SearchNode.RequestThreads(); Tuning.SearchNode.RequestThreads rt = sn.threads; @@ -180,9 +192,9 @@ public class DomSearchTuningBuilder extends VespaDomBuilder.DomConfigProducerBui Tuning.SearchNode.Index.Warmup warmup = sn.index.warmup; for (Element e2 : XML.getChildren(e)) { if (equals("time", e2)) { - warmup.time = Double.valueOf(asString(e2)); + warmup.time = asDouble(e2); } else if (equals("unpack", e2)) { - warmup.unpack = Boolean.valueOf(asString(e2)); + warmup.unpack = Boolean.parseBoolean(asString(e2)); } } } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/Tuning.java b/config-model/src/main/java/com/yahoo/vespa/model/search/Tuning.java index a29b7b90b44..93e3a6e7a19 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/Tuning.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/Tuning.java @@ -53,6 +53,16 @@ public class Tuning extends AnyConfigProducer implements ProtonConfig.Producer { } } + public static class LidSpace implements ProtonConfig.Producer { + public Double bloatFactor = null; + + @Override + public void getConfig(ProtonConfig.Builder builder) { + if (bloatFactor != null) builder.lidspacecompaction.allowedlidbloatfactor(bloatFactor); + } + + } + public static class RemovedDB implements ProtonConfig.Producer { public static class Prune implements ProtonConfig.Producer { @@ -371,6 +381,7 @@ public class Tuning extends AnyConfigProducer implements ProtonConfig.Producer { } public RequestThreads threads = null; + public LidSpace lidSpace = null; public FlushStrategy strategy = null; public Resizing resizing = null; public Index index = null; @@ -383,6 +394,7 @@ public class Tuning extends AnyConfigProducer implements ProtonConfig.Producer { @Override public void getConfig(ProtonConfig.Builder builder) { if (threads != null) threads.getConfig(builder); + if (lidSpace != null) lidSpace.getConfig(builder); if (strategy != null) strategy.getConfig(builder); if (resizing != null) resizing.getConfig(builder); if (index != null) index.getConfig(builder); diff --git a/config-model/src/main/resources/schema/content.rnc b/config-model/src/main/resources/schema/content.rnc index 6486fdacc18..5833b575a74 100644 --- a/config-model/src/main/resources/schema/content.rnc +++ b/config-model/src/main/resources/schema/content.rnc @@ -301,6 +301,9 @@ Tuning = element tuning { element persearch { xsd:nonNegativeInteger }? & element summary { xsd:nonNegativeInteger }? }? & + element lidspace { + element max-bloat-factor { xsd:double { minInclusive = "0.0" maxInclusive = "1.0" } }? + }? & element flushstrategy { element native { element total { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java index 41cef783b68..e3e9fc1a232 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java @@ -58,6 +58,16 @@ public class DomSchemaTuningBuilderTest extends DomBuilderTest { } @Test + void requireThatWeCanParseLidSpaceTag() { + Tuning t = createTuning(parseXml("<lidspace>", + "<max-bloat-factor>0.5</max-bloat-factor>", + "</lidspace>")); + assertEquals(0.5, t.searchNode.lidSpace.bloatFactor.doubleValue()); + ProtonConfig cfg = getProtonCfg(t); + assertEquals(cfg.lidspacecompaction().allowedlidbloatfactor(), 0.5); + } + + @Test void requireThatWeCanParseFlushStrategyTag() { Tuning t = createTuning(parseXml("<flushstrategy>", "<native>", "<total>", |