From 2044b38d1b8cd21afb0f842715f33e3649496c8b Mon Sep 17 00:00:00 2001 From: Geir Storli Date: Mon, 9 Oct 2017 15:33:59 +0200 Subject: Fix such that adding a document type in proton doesn't require a restart. The backend already handles this. --- .../change/ConfigValueChangeValidatorTest.java | 32 +++++++++++++++++++--- searchcore/src/vespa/searchcore/config/proton.def | 6 ++-- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java index cbb725987eb..f9944f563c4 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java @@ -64,6 +64,14 @@ public class ConfigValueChangeValidatorTest { assertComponentsEquals(changes, "docproc/cluster.basicsearch.indexing/0", 2); } + @Test + public void requireThatDocumentTypesCanBeAddedWithoutNeedForRestart() { + List changes = getConfigChanges( + createVespaModel("", Arrays.asList("foo")), + createVespaModel("", Arrays.asList("foo", "bar"))); + assertEquals(0, changes.size()); + } + @Test public void requireThatValidatorDetectsConfigChangeFromService() { MockRoot oldRoot = createRootWithChildren(new SimpleConfigProducer("p", 0) @@ -162,6 +170,10 @@ public class ConfigValueChangeValidatorTest { } private static VespaModel createVespaModel(String configSegment) { + return createVespaModel(configSegment, Arrays.asList("music")); + } + + private static VespaModel createVespaModel(String configSegment, List docTypes) { // Note that the configSegment is here located on root. return new VespaModelCreatorWithMockPkg( null, @@ -178,9 +190,7 @@ public class ConfigValueChangeValidatorTest { " \n" + " \n" + " 1\n" + - " \n" + - " \n" + - " \n" + + createDocumentsSegment(docTypes) + "\n" + " \n" + " \n" + " \n" + @@ -191,10 +201,24 @@ public class ConfigValueChangeValidatorTest { " \n" + " \n" + "", - Collections.singletonList("search music { document music { } }") + createSearchDefinitions(docTypes) ).create(); } + private static String createDocumentsSegment(List docTypes) { + return "\n" + + docTypes.stream() + .map(type -> "") + .collect(Collectors.joining("\n")) + + ""; + } + + private static List createSearchDefinitions(List docTypes) { + return docTypes.stream() + .map(type -> "search " + type + " { document " + type + " { } }") + .collect(Collectors.toList()); + } + private static String createQrStartConfigSegment(boolean verboseGc, int heapsize) { return "\n" + " \n" + diff --git a/searchcore/src/vespa/searchcore/config/proton.def b/searchcore/src/vespa/searchcore/config/proton.def index 8c01c45dac8..2fd991538ab 100644 --- a/searchcore/src/vespa/searchcore/config/proton.def +++ b/searchcore/src/vespa/searchcore/config/proton.def @@ -279,13 +279,13 @@ summary.read.mmap.advise enum {NORMAL, RANDOM, SEQUENTIAL} default=NORMAL restar summary.compact2buckets bool default=true restart ## The name of the input document type -documentdb[].inputdoctypename string restart +documentdb[].inputdoctypename string ## The configid used to subscribe to config for this database. -documentdb[].configid string restart +documentdb[].configid string ## How many seconds is allowed from document is received to it is visible in the index. documentdb[].visibilitydelay double default=0.0 ## Whether this document type is globally distributed or not. -documentdb[].global bool default=false restart +documentdb[].global bool default=false ## The interval of when periodic tasks should be run periodic.interval double default=3600.0 -- cgit v1.2.3