diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-10-26 22:38:08 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-10-26 22:38:08 +0200 |
commit | 358df1ca460e9589fd1bc33c32e5cefc2407a963 (patch) | |
tree | 65064f734adc3587fd2607ab3a04ed921293a674 /config-model | |
parent | 5a40a281b83974f046c245701ff85b75f05e2d0d (diff) |
Add deprecation warnings on deploy and ignore what is void.
Diffstat (limited to 'config-model')
4 files changed, 23 insertions, 85 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 50e6cace8b8..273e5580403 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 @@ -1,6 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.builder.xml.dom; +import com.yahoo.config.application.api.DeployLogger; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.text.XML; import com.yahoo.config.model.producer.AnyConfigProducer; @@ -8,6 +9,8 @@ import com.yahoo.config.model.producer.TreeConfigProducer; import com.yahoo.vespa.model.search.Tuning; import org.w3c.dom.Element; +import java.util.logging.Level; + /** * Builder for the tuning config for a search cluster. * @@ -20,7 +23,7 @@ public class DomSearchTuningBuilder extends VespaDomBuilder.DomConfigProducerBui Tuning tuning = new Tuning(parent); for (Element e : XML.getChildren(spec)) { if (equals("searchnode", e)) - handleSearchNode(e, tuning); + handleSearchNode(deployState.getDeployLogger(), e, tuning); } return tuning; } @@ -45,7 +48,7 @@ public class DomSearchTuningBuilder extends VespaDomBuilder.DomConfigProducerBui return Double.parseDouble(e.getFirstChild().getNodeValue()); } - private void handleSearchNode(Element spec, Tuning t) { + private void handleSearchNode(DeployLogger deployLogger, Element spec, Tuning t) { t.searchNode = new Tuning.SearchNode(); for (Element e : XML.getChildren(spec)) { if (equals("requestthreads", e)) { @@ -53,13 +56,13 @@ public class DomSearchTuningBuilder extends VespaDomBuilder.DomConfigProducerBui } else if (equals("flushstrategy", e)) { handleFlushStrategy(e, t.searchNode); } else if (equals("resizing", e)) { - handleResizing(e, t.searchNode); + handleResizing(deployLogger, e, t.searchNode); } else if (equals("index", e)) { - handleIndex(e, t.searchNode); + handleIndex(deployLogger, e, t.searchNode); } else if (equals("attribute", e)) { - handleAttribute(e, t.searchNode); + deployLogger.logApplicationPackage(Level.WARNING, "searchnode.attribute is deprecated and ignored."); } else if (equals("summary", e)) { - handleSummary(e, t.searchNode); + handleSummary(deployLogger, e, t.searchNode); } else if (equals("initialize", e)) { handleInitialize(e, t.searchNode); } else if (equals("feeding", e)) { @@ -161,18 +164,19 @@ public class DomSearchTuningBuilder extends VespaDomBuilder.DomConfigProducerBui } } - private void handleResizing(Element spec, Tuning.SearchNode sn) { + private void handleResizing(DeployLogger deployLogger, Element spec, Tuning.SearchNode sn) { sn.resizing = new Tuning.SearchNode.Resizing(); for (Element e : XML.getChildren(spec)) { if (equals("initialdocumentcount", e)) { + deployLogger.logApplicationPackage(Level.WARNING, "resizing.initialdocumentcount is deprecated."); sn.resizing.initialDocumentCount = asInt(e); } else if (equals("amortize-count", e)) { - sn.resizing.amortizeCount = asInt(e); + deployLogger.logApplicationPackage(Level.WARNING, "resizing.amortize-count is deprecated and ignored"); } } } - private void handleIndex(Element spec, Tuning.SearchNode sn) { + private void handleIndex(DeployLogger deployLogger, Element spec, Tuning.SearchNode sn) { sn.index = new Tuning.SearchNode.Index(); for (Element e : XML.getChildren(spec)) { if (equals("io", e)) { @@ -180,9 +184,9 @@ public class DomSearchTuningBuilder extends VespaDomBuilder.DomConfigProducerBui Tuning.SearchNode.Index.Io io = sn.index.io; for (Element e2 : XML.getChildren(e)) { if (equals("write", e2)) { - io.write = Tuning.SearchNode.IoType.fromString(asString(e2)); + deployLogger.logApplicationPackage(Level.WARNING, "index.io.write is deprecated and ignored."); } else if (equals("read", e2)) { - io.read = Tuning.SearchNode.IoType.fromString(asString(e2)); + deployLogger.logApplicationPackage(Level.WARNING, "index.io.read is deprecated and ignored."); } else if (equals("search", e2)) { io.search = Tuning.SearchNode.IoType.fromString(asString(e2)); } @@ -201,28 +205,14 @@ public class DomSearchTuningBuilder extends VespaDomBuilder.DomConfigProducerBui } } - private void handleAttribute(Element spec, Tuning.SearchNode sn) { - sn.attribute = new Tuning.SearchNode.Attribute(); - for (Element e : XML.getChildren(spec)) { - if (equals("io", e)) { - sn.attribute.io = new Tuning.SearchNode.Attribute.Io(); - for (Element e2 : XML.getChildren(e)) { - if (equals("write", e2)) { - sn.attribute.io.write = Tuning.SearchNode.IoType.fromString(asString(e2)); - } - } - } - } - } - - private void handleSummary(Element spec, Tuning.SearchNode sn) { + private void handleSummary(DeployLogger deployLogger, Element spec, Tuning.SearchNode sn) { sn.summary = new Tuning.SearchNode.Summary(); for (Element e : XML.getChildren(spec)) { if (equals("io", e)) { sn.summary.io = new Tuning.SearchNode.Summary.Io(); for (Element e2 : XML.getChildren(e)) { if (equals("write", e2)) { - sn.summary.io.write = Tuning.SearchNode.IoType.fromString(asString(e2)); + deployLogger.logApplicationPackage(Level.WARNING, "summary.io.write is deprecated and ignored."); } else if (equals("read", e2)) { sn.summary.io.read = Tuning.SearchNode.IoType.fromString(asString(e2)); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java b/config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java index 003cbbe78a8..2beec421faa 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java @@ -24,7 +24,7 @@ public class NodeResourcesTuning implements ProtonConfig.Producer { final static long MB = 1024 * 1024; public final static long GB = MB * 1024; // This is an approximate number based on observation of a node using 33G memory with 765M docs - private final static long MEMORY_COST_PER_DOCUMENT_STORE_ONLY = 46L; + private final static long MEMORY_COST_PER_DOCUMENT_DB_ONLY = 46L; private final NodeResources resources; private final int threadsPerSearch; private final double fractionOfMemoryReserved; @@ -58,9 +58,10 @@ public class NodeResourcesTuning implements ProtonConfig.Producer { } private void getConfig(ProtonConfig.Documentdb.Builder builder) { + // TODO => Move this to backend to enable ignoring this setting. ProtonConfig.Documentdb dbCfg = builder.build(); if (dbCfg.mode() != ProtonConfig.Documentdb.Mode.Enum.INDEX) { - long numDocs = (long)usableMemoryGb() * GB / MEMORY_COST_PER_DOCUMENT_STORE_ONLY; + long numDocs = (long)usableMemoryGb() * GB / MEMORY_COST_PER_DOCUMENT_DB_ONLY; builder.allocation.initialnumdocs(numDocs/redundancy.readyCopies()); } } 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 e8d42b701ef..9621ddd1374 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 @@ -120,8 +120,8 @@ public class Tuning extends AnyConfigProducer implements ProtonConfig.Producer { } public static class Resizing implements ProtonConfig.Producer { + // TODO GC as soon as resource computation is moved to backend. public Integer initialDocumentCount = null; - public Integer amortizeCount = null; @Override public void getConfig(ProtonConfig.Builder builder) { @@ -130,29 +130,16 @@ public class Tuning extends AnyConfigProducer implements ProtonConfig.Producer { db.allocation.initialnumdocs(initialDocumentCount); } } - if (amortizeCount !=null) { - for (ProtonConfig.Documentdb.Builder db : builder.documentdb) { - db.allocation.amortizecount(amortizeCount); - } - } } } public static class Index implements ProtonConfig.Producer { public static class Io implements ProtonConfig.Producer { - public IoType write = null; - public IoType read = null; public IoType search = null; @Override public void getConfig(ProtonConfig.Builder builder) { - if (write != null) { - builder.indexing.write.io(ProtonConfig.Indexing.Write.Io.Enum.valueOf(write.name)); - } - if (read != null) { - builder.indexing.read.io(ProtonConfig.Indexing.Read.Io.Enum.valueOf(read.name)); - } if (search != null) { if (search.equals(IoType.POPULATE)) { builder.search.mmap.options.add(ProtonConfig.Search.Mmap.Options.POPULATE); @@ -184,38 +171,11 @@ public class Tuning extends AnyConfigProducer implements ProtonConfig.Producer { } } - public static class Attribute implements ProtonConfig.Producer { - public static class Io implements ProtonConfig.Producer { - public IoType write = null; - - public Io() {} - - @Override - public void getConfig(ProtonConfig.Builder builder) { - if (write != null) { - builder.attribute.write.io(ProtonConfig.Attribute.Write.Io.Enum.valueOf(write.name)); - } - } - } - - public Io io; - - @Override - public void getConfig(ProtonConfig.Builder builder) { - if (io != null) io.getConfig(builder); - } - - } - public static class Summary implements ProtonConfig.Producer { public static class Io { - public IoType write = null; public IoType read = null; public void getConfig(ProtonConfig.Summary.Builder builder) { - if (write != null) { - builder.write.io(ProtonConfig.Summary.Write.Io.Enum.valueOf(write.name)); - } if (read != null) { if (read.equals(IoType.POPULATE)) { builder.read.io(ProtonConfig.Summary.Read.Io.MMAP); @@ -389,7 +349,6 @@ public class Tuning extends AnyConfigProducer implements ProtonConfig.Producer { public FlushStrategy strategy = null; public Resizing resizing = null; public Index index = null; - public Attribute attribute = null; public Summary summary = null; public Initialize initialize = null; public Feeding feeding = null; @@ -402,7 +361,6 @@ public class Tuning extends AnyConfigProducer implements ProtonConfig.Producer { if (strategy != null) strategy.getConfig(builder); if (resizing != null) resizing.getConfig(builder); if (index != null) index.getConfig(builder); - if (attribute != null) attribute.getConfig(builder); if (summary != null) summary.getConfig(builder); if (initialize != null) initialize.getConfig(builder); if (feeding != null) feeding.getConfig(builder); 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 4d2900b9e94..963fce0c666 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 @@ -27,10 +27,6 @@ public class DomSchemaTuningBuilderTest extends DomBuilderTest { "</tuning>"); } - private Tuning newTuning(String xml) { - return createTuning(parse(xml)); - } - private Tuning createTuning(Element xml) { DomSearchTuningBuilder b = new DomSearchTuningBuilder(); return b.build(root.getDeployState(), root, xml); @@ -113,14 +109,11 @@ public class DomSchemaTuningBuilderTest extends DomBuilderTest { "<amortize-count>13</amortize-count>", "</resizing>")); assertEquals(128, t.searchNode.resizing.initialDocumentCount.intValue()); - assertEquals(13, t.searchNode.resizing.amortizeCount.intValue()); } @Test void requireThatWeCanParseIndexTag() { Tuning t = createTuning(parseXml("<index>", "<io>", - "<write>directio</write>", - "<read>normal</read>", "<search>mmap</search>", "</io>", "<warmup>" + @@ -128,14 +121,12 @@ public class DomSchemaTuningBuilderTest extends DomBuilderTest { "<unpack>true</unpack>", "</warmup>", "</index>")); - assertEquals(Tuning.SearchNode.IoType.DIRECTIO, t.searchNode.index.io.write); - assertEquals(Tuning.SearchNode.IoType.NORMAL, t.searchNode.index.io.read); assertEquals(Tuning.SearchNode.IoType.MMAP, t.searchNode.index.io.search); assertEquals(178, t.searchNode.index.warmup.time, DELTA); assertTrue(t.searchNode.index.warmup.unpack); ProtonConfig cfg = getProtonCfg(t); assertEquals(cfg.indexing().write().io(), ProtonConfig.Indexing.Write.Io.DIRECTIO); - assertEquals(cfg.indexing().read().io(), ProtonConfig.Indexing.Read.Io.NORMAL); + assertEquals(cfg.indexing().read().io(), ProtonConfig.Indexing.Read.Io.DIRECTIO); assertEquals(cfg.index().warmup().time(), 178, DELTA); assertTrue(cfg.index().warmup().unpack()); } @@ -172,9 +163,8 @@ public class DomSchemaTuningBuilderTest extends DomBuilderTest { @Test void requireThatWeCanParseAttributeTag() { Tuning t = createTuning(parseXml("<attribute>", "<io>", - "<write>directio</write>", + "<write>normal</write>", "</io>", "</attribute>")); - assertEquals(Tuning.SearchNode.IoType.DIRECTIO, t.searchNode.attribute.io.write); ProtonConfig cfg = getProtonCfg(t); assertEquals(cfg.attribute().write().io(), ProtonConfig.Attribute.Write.Io.DIRECTIO); } @@ -209,7 +199,6 @@ public class DomSchemaTuningBuilderTest extends DomBuilderTest { "</logstore>", "</store>", "</summary>")); - assertEquals(Tuning.SearchNode.IoType.DIRECTIO, t.searchNode.summary.io.write); assertEquals(Tuning.SearchNode.IoType.DIRECTIO, t.searchNode.summary.io.read); assertEquals(128, t.searchNode.summary.store.cache.maxSize.longValue()); assertEquals(30.7, t.searchNode.summary.store.cache.maxSizePercent, DELTA); |