aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cloud-tenant-base-dependencies-enforcer/pom.xml2
-rw-r--r--config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java2
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java14
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java17
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java7
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java2
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java10
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java19
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java52
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java22
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java60
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaNodeTest.java4
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java7
-rw-r--r--documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/storagepolicy/ContentPolicyTestEnvironment.java2
-rw-r--r--flags/src/main/java/com/yahoo/vespa/flags/Flags.java14
-rw-r--r--parent/pom.xml2
16 files changed, 174 insertions, 62 deletions
diff --git a/cloud-tenant-base-dependencies-enforcer/pom.xml b/cloud-tenant-base-dependencies-enforcer/pom.xml
index 92a6d886866..83434209615 100644
--- a/cloud-tenant-base-dependencies-enforcer/pom.xml
+++ b/cloud-tenant-base-dependencies-enforcer/pom.xml
@@ -274,7 +274,7 @@
<include>org.kohsuke:libpam4j:1.11:jar:test</include>
<include>org.opentest4j:opentest4j:1.2.0:jar:test</include>
<include>software.amazon.ion:ion-java:1.0.2:jar:test</include>
- <include>xerces:xercesImpl:2.12.0:jar:test</include>
+ <include>xerces:xercesImpl:2.12.1:jar:test</include>
</includes>
</bannedDependencies>
</rules>
diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java
index 1f78ad20e40..6c70af8cbca 100644
--- a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java
+++ b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java
@@ -111,6 +111,8 @@ public interface ModelContext {
@ModelFeatureFlag(owners = {"arnej"}) default boolean useV8GeoPositions() { return false; }
@ModelFeatureFlag(owners = {"arnej", "baldersheim"}) default boolean useV8DocManagerCfg() { return false; }
@ModelFeatureFlag(owners = {"baldersheim", "geirst", "toregge"}) default int maxCompactBuffers() { return 1; }
+ @ModelFeatureFlag(owners = {"hmusum"}) default boolean failDeploymentWithInvalidJvmOptions() { return false; }
+ @ModelFeatureFlag(owners = {"baldersheim"}) default double tlsSizeFraction() { throw new UnsupportedOperationException("TODO specify default value"); }
}
/** Warning: As elsewhere in this package, do not make backwards incompatible changes that will break old config models! */
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
index cf649162c08..e645fec5520 100644
--- a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
+++ b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
@@ -76,6 +76,8 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
private boolean unorderedMergeChaining = false;
private List<String> zoneDnsSuffixes = List.of();
private int maxCompactBuffers = 1;
+ private boolean failDeploymentWithInvalidJvmOptions = false;
+ private double tlsSizeFraction = 0.07;
@Override public ModelContext.FeatureFlags featureFlags() { return this; }
@Override public boolean multitenant() { return multitenant; }
@@ -132,6 +134,8 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
@Override public boolean unorderedMergeChaining() { return unorderedMergeChaining; }
@Override public List<String> zoneDnsSuffixes() { return zoneDnsSuffixes; }
@Override public int maxCompactBuffers() { return maxCompactBuffers; }
+ @Override public boolean failDeploymentWithInvalidJvmOptions() { return failDeploymentWithInvalidJvmOptions; }
+ @Override public double tlsSizeFraction() { return tlsSizeFraction; }
public TestProperties maxUnCommittedMemory(int maxUnCommittedMemory) {
this.maxUnCommittedMemory = maxUnCommittedMemory;
@@ -347,6 +351,16 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
return this;
}
+ public TestProperties failDeploymentWithInvalidJvmOptions(boolean fail) {
+ failDeploymentWithInvalidJvmOptions = fail;
+ return this;
+ }
+
+ public TestProperties tlsSizeFraction(double tlsSizeFraction) {
+ this.tlsSizeFraction = tlsSizeFraction;
+ return this;
+ }
+
public static class Spec implements ConfigServerSpec {
private final String hostName;
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
index d7691f4c486..c8b2197fc29 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
@@ -1133,19 +1133,21 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
*/
private static class JvmGcOptions {
- private static final Pattern validPattern = Pattern.compile("-XX:[+-][a-zA-z0-9=]+");
+ private static final Pattern validPattern = Pattern.compile("-XX:[+-]*[a-zA-z0-9=]+");
private static final Pattern invalidCMSPattern = Pattern.compile("-XX:[+-]\\w*CMS[a-zA-z0-9=]+");
private final DeployState deployState;
private final String jvmGcOptions;
private final DeployLogger logger;
private final boolean isHosted;
+ private final boolean failDeploymentWithInvalidJvmOptions;
public JvmGcOptions(DeployState deployState, String jvmGcOptions) {
this.deployState = deployState;
this.jvmGcOptions = jvmGcOptions;
this.logger = deployState.getDeployLogger();
this.isHosted = deployState.isHosted();
+ this.failDeploymentWithInvalidJvmOptions = deployState.featureFlags().failDeploymentWithInvalidJvmOptions();
}
private String build() {
@@ -1162,13 +1164,12 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
// CMS GC options cannot be used in hosted, CMS is unsupported in JDK 17
invalidOptions.addAll(Arrays.stream(optionList)
.filter(option -> !option.isEmpty())
- .filter(option -> Pattern
- .matches(invalidCMSPattern.pattern(), option) ||
+ .filter(option -> Pattern.matches(invalidCMSPattern.pattern(), option) ||
option.equals("-XX:+UseConcMarkSweepGC"))
.collect(Collectors.toList()));
}
- logInvalidOptions(invalidOptions);
+ logOrFailInvalidOptions(invalidOptions);
}
if (options == null || options.isEmpty())
@@ -1177,11 +1178,15 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
return options;
}
- private void logInvalidOptions(List<String> options) {
+ private void logOrFailInvalidOptions(List<String> options) {
if (options.isEmpty()) return;
Collections.sort(options);
- logger.logApplicationPackage(WARNING, "Invalid JVM GC options from services.xml: " + String.join(",", options));
+ String message = "Invalid JVM GC options from services.xml: " + String.join(",", options);
+ if (failDeploymentWithInvalidJvmOptions)
+ throw new IllegalArgumentException(message);
+ else
+ logger.logApplicationPackage(WARNING, message);
}
}
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 fb6e2dc0bd8..54d09bacfa9 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
@@ -290,7 +290,8 @@ public class ContentSearchCluster extends AbstractConfigProducer<SearchCluster>
Optional<Tuning> tuning = Optional.ofNullable(this.tuning);
if (element == null) {
searchNode = SearchNode.create(parent, "" + node.getDistributionKey(), node.getDistributionKey(), spec,
- clusterName, node, flushOnShutdown, tuning, resourceLimits, parentGroup.isHosted(), fractionOfMemoryReserved);
+ clusterName, node, flushOnShutdown, tuning, resourceLimits, parentGroup.isHosted(),
+ fractionOfMemoryReserved, deployState.featureFlags().tlsSizeFraction());
searchNode.setHostResource(node.getHostResource());
searchNode.initService(deployState.getDeployLogger());
@@ -298,7 +299,9 @@ public class ContentSearchCluster extends AbstractConfigProducer<SearchCluster>
tls.setHostResource(searchNode.getHostResource());
tls.initService(deployState.getDeployLogger());
} else {
- searchNode = new SearchNode.Builder(""+node.getDistributionKey(), spec, clusterName, node, flushOnShutdown, tuning, resourceLimits, fractionOfMemoryReserved).build(deployState, parent, element.getXml());
+ searchNode = new SearchNode.Builder(""+node.getDistributionKey(), spec, clusterName, node, flushOnShutdown,
+ tuning, resourceLimits, fractionOfMemoryReserved)
+ .build(deployState, parent, element.getXml());
tls = new TransactionLogServer.Builder(clusterName, syncTransactionLog).build(deployState, searchNode, element.getXml());
}
searchNode.setTls(tls);
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java
index 9ab684c3f9d..628cf6bb4c7 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java
@@ -240,7 +240,7 @@ public class ContentCluster extends AbstractConfigProducer<AbstractConfigProduce
}
}
- /** Returns whether this hosts one of the given container clusters */
+ /** Returns of memory reserved on a host. Memory is reserved for the jvm if th ecluster is combined */
private double fractionOfMemoryReserved(String clusterId, Collection<ContainerModel> containers) {
for (ContainerModel containerModel : containers) {
Optional<String> hostClusterId = containerModel.getCluster().getHostClusterId();
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 652029dfef3..3af0b49de82 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
@@ -5,6 +5,7 @@ import com.yahoo.config.provision.NodeResources;
import com.yahoo.vespa.config.search.core.ProtonConfig;
import static java.lang.Long.min;
+import static java.lang.Long.max;
/**
* Tuning of proton config for a search node based on the resources on the node.
@@ -20,16 +21,19 @@ public class NodeResourcesTuning implements ProtonConfig.Producer {
private final NodeResources resources;
private final int threadsPerSearch;
private final double fractionOfMemoryReserved;
+ private final double tlsSizeFraction;
// "Reserve" 0.5GB of memory for other processes running on the content node (config-proxy, metrics-proxy).
public static final double reservedMemoryGb = 0.5;
public NodeResourcesTuning(NodeResources resources,
int threadsPerSearch,
- double fractionOfMemoryReserved) {
+ double fractionOfMemoryReserved,
+ double tlsSizeFraction) {
this.resources = resources;
this.threadsPerSearch = threadsPerSearch;
this.fractionOfMemoryReserved = fractionOfMemoryReserved;
+ this.tlsSizeFraction = tlsSizeFraction;
}
@Override
@@ -94,8 +98,8 @@ public class NodeResourcesTuning implements ProtonConfig.Producer {
}
private void tuneFlushStrategyTlsSize(ProtonConfig.Flush.Memory.Builder builder) {
- long tlsSizeBytes = (long) ((resources.diskGb() * 0.07) * GB);
- tlsSizeBytes = min(tlsSizeBytes, 100 * GB);
+ long tlsSizeBytes = (long) ((resources.diskGb() * tlsSizeFraction) * GB);
+ tlsSizeBytes = max(2*GB, min(tlsSizeBytes, 100 * GB));
builder.maxtlssize(tlsSizeBytes);
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java
index 6a4be692b0c..31513a273b2 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java
@@ -68,6 +68,7 @@ public class SearchNode extends AbstractService implements
private final Optional<Tuning> tuning;
private final Optional<ResourceLimits> resourceLimits;
private final double fractionOfMemoryReserved;
+ private final double tlsSizeFraction;
public static class Builder extends VespaDomBuilder.DomConfigProducerBuilder<SearchNode> {
@@ -96,7 +97,8 @@ public class SearchNode extends AbstractService implements
@Override
protected SearchNode doBuild(DeployState deployState, AbstractConfigProducer ancestor, Element producerSpec) {
return new SearchNode(ancestor, name, contentNode.getDistributionKey(), nodeSpec, clusterName, contentNode,
- flushOnShutdown, tuning, resourceLimits, deployState.isHosted(), fractionOfMemoryReserved);
+ flushOnShutdown, tuning, resourceLimits, deployState.isHosted(), fractionOfMemoryReserved,
+ deployState.featureFlags().tlsSizeFraction());
}
}
@@ -104,16 +106,16 @@ public class SearchNode extends AbstractService implements
public static SearchNode create(AbstractConfigProducer parent, String name, int distributionKey, NodeSpec nodeSpec,
String clusterName, AbstractService serviceLayerService, boolean flushOnShutdown,
Optional<Tuning> tuning, Optional<ResourceLimits> resourceLimits, boolean isHostedVespa,
- double fractionOfMemoryReserved) {
- return new SearchNode(parent, name, distributionKey, nodeSpec, clusterName, serviceLayerService,
- flushOnShutdown, tuning, resourceLimits, isHostedVespa, fractionOfMemoryReserved);
+ double fractionOfMemoryReserved, double tlsSizeFraction) {
+ return new SearchNode(parent, name, distributionKey, nodeSpec, clusterName, serviceLayerService, flushOnShutdown,
+ tuning, resourceLimits, isHostedVespa, fractionOfMemoryReserved, tlsSizeFraction);
}
private SearchNode(AbstractConfigProducer parent, String name, int distributionKey, NodeSpec nodeSpec,
String clusterName, AbstractService serviceLayerService, boolean flushOnShutdown,
Optional<Tuning> tuning, Optional<ResourceLimits> resourceLimits, boolean isHostedVespa,
- double fractionOfMemoryReserved) {
- this(parent, name, nodeSpec, clusterName, flushOnShutdown, tuning, resourceLimits, isHostedVespa, fractionOfMemoryReserved);
+ double fractionOfMemoryReserved, double tlsSizeFraction) {
+ this(parent, name, nodeSpec, clusterName, flushOnShutdown, tuning, resourceLimits, isHostedVespa, fractionOfMemoryReserved, tlsSizeFraction);
this.distributionKey = distributionKey;
this.serviceLayerService = serviceLayerService;
setPropertiesElastic(clusterName, distributionKey);
@@ -121,11 +123,12 @@ public class SearchNode extends AbstractService implements
private SearchNode(AbstractConfigProducer parent, String name, NodeSpec nodeSpec, String clusterName,
boolean flushOnShutdown, Optional<Tuning> tuning, Optional<ResourceLimits> resourceLimits, boolean isHostedVespa,
- double fractionOfMemoryReserved) {
+ double fractionOfMemoryReserved, double tlsSizeFraction) {
super(parent, name);
setOmpNumThreads(1);
this.isHostedVespa = isHostedVespa;
this.fractionOfMemoryReserved = fractionOfMemoryReserved;
+ this.tlsSizeFraction = tlsSizeFraction;
this.nodeSpec = nodeSpec;
this.clusterName = clusterName;
this.flushOnShutdown = flushOnShutdown;
@@ -279,7 +282,7 @@ public class SearchNode extends AbstractService implements
if (nodeResources.isPresent()) {
var nodeResourcesTuning = new NodeResourcesTuning(nodeResources.get(),
tuning.map(Tuning::threadsPerSearch).orElse(1),
- fractionOfMemoryReserved);
+ fractionOfMemoryReserved, tlsSizeFraction);
nodeResourcesTuning.getConfig(builder);
tuning.ifPresent(t -> t.getConfig(builder));
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java
index 4d34df98fb7..5fe2baaca37 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java
@@ -12,7 +12,9 @@ import com.yahoo.config.model.test.MockApplicationPackage;
import com.yahoo.search.config.QrStartConfig;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.container.ContainerCluster;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
@@ -22,6 +24,7 @@ import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -32,6 +35,8 @@ import static org.junit.Assert.assertTrue;
*/
public class JvmOptionsTest extends ContainerModelBuilderTestBase {
+ @Rule public ExpectedException expectedException = ExpectedException.none();
+
@Test
public void verify_jvm_tag_with_attributes() throws IOException, SAXException {
String servicesXml =
@@ -166,31 +171,28 @@ public class JvmOptionsTest extends ContainerModelBuilderTestBase {
"$(touch", "/tmp/hello-from-gc-options)");
// Valid options, should not log anything
- verifyLoggingOfJvmGcOptions(true,
- "-XX:+ParallelGCThreads=8");
+ verifyLoggingOfJvmGcOptions(true, "-XX:+ParallelGCThreads=8");
+ verifyLoggingOfJvmGcOptions(true, "-XX:MaxTenuringThreshold"); // No + or - after colon
verifyLoggingOfJvmGcOptions(false, "-XX:+UseConcMarkSweepGC");
}
+ @Test
+ public void requireThatInvalidJvmGcOptionsFailDeployment() throws IOException, SAXException {
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage(containsString("Invalid JVM GC options from services.xml: bar,foo"));
+ buildModelWithJvmOptions(new TestProperties().setHostedVespa(true).failDeploymentWithInvalidJvmOptions(true),
+ new TestLogger(),
+ "gc-options",
+ "-XX:+ParallelGCThreads=8 foo bar");
+ }
private void verifyLoggingOfJvmGcOptions(boolean isHosted, String override, String... invalidOptions) throws IOException, SAXException {
verifyLoggingOfJvmOptions(isHosted, "gc-options", override, invalidOptions);
}
private void verifyLoggingOfJvmOptions(boolean isHosted, String optionName, String override, String... invalidOptions) throws IOException, SAXException {
- String servicesXml =
- "<container version='1.0'>" +
- " <nodes>" +
- " <jvm " + optionName + "='" + override + "'/>" +
- " <node hostalias='mockhost'/>" +
- " </nodes>" +
- "</container>";
- ApplicationPackage app = new MockApplicationPackage.Builder().withServices(servicesXml).build();
TestLogger logger = new TestLogger();
- new VespaModel(new NullConfigModelRegistry(), new DeployState.Builder()
- .applicationPackage(app)
- .deployLogger(logger)
- .properties(new TestProperties().setHostedVespa(isHosted))
- .build());
+ buildModelWithJvmOptions(isHosted, logger, optionName, override);
List<String> strings = Arrays.asList(invalidOptions.clone());
if (strings.isEmpty()) return;
@@ -202,6 +204,26 @@ public class JvmOptionsTest extends ContainerModelBuilderTestBase {
"options from services.xml: " + String.join(",", strings), firstOption.getSecond());
}
+ private void buildModelWithJvmOptions(boolean isHosted, TestLogger logger, String optionName, String override) throws IOException, SAXException {
+ buildModelWithJvmOptions(new TestProperties().setHostedVespa(isHosted), logger, optionName, override);
+ }
+
+ private void buildModelWithJvmOptions(TestProperties properties, TestLogger logger, String optionName, String override) throws IOException, SAXException {
+ String servicesXml =
+ "<container version='1.0'>" +
+ " <nodes>" +
+ " <jvm " + optionName + "='" + override + "'/>" +
+ " <node hostalias='mockhost'/>" +
+ " </nodes>" +
+ "</container>";
+ ApplicationPackage app = new MockApplicationPackage.Builder().withServices(servicesXml).build();
+ new VespaModel(new NullConfigModelRegistry(), new DeployState.Builder()
+ .applicationPackage(app)
+ .deployLogger(logger)
+ .properties(properties)
+ .build());
+ }
+
@Test
public void requireThatJvmOptionsAreLogged() throws IOException, SAXException {
verifyLoggingOfJvmOptions(true, "options", "-Xms2G");
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java
index 357ae7e2656..d0515ae37e8 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java
@@ -47,6 +47,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.OptionalDouble;
import java.util.OptionalInt;
import static org.junit.Assert.assertEquals;
@@ -1048,6 +1049,27 @@ public class ContentClusterTest extends ContentBaseTest {
assertEquals(7, resolveMaxCompactBuffers(OptionalInt.of(7)));
}
+ private long resolveMaxTLSSize(OptionalDouble tlsSizeFraction, Optional<Flavor> flavor) throws Exception {
+ TestProperties testProperties = new TestProperties();
+ if (tlsSizeFraction.isPresent()) {
+ testProperties.tlsSizeFraction(tlsSizeFraction.getAsDouble());
+ }
+ ContentCluster cc = createOneNodeCluster(testProperties, flavor);
+ ProtonConfig.Builder protonBuilder = new ProtonConfig.Builder();
+ cc.getSearch().getSearchNodes().get(0).getConfig(protonBuilder);
+ ProtonConfig protonConfig = new ProtonConfig(protonBuilder);
+ return protonConfig.flush().memory().maxtlssize();
+ }
+ @Test
+ public void default_max_tls_size_controlled_by_properties() throws Exception {
+ var flavor = new Flavor(new FlavorsConfig.Flavor(new FlavorsConfig.Flavor.Builder().name("test").minDiskAvailableGb(100)));
+ assertEquals(21474836480L, resolveMaxTLSSize(OptionalDouble.empty(), Optional.empty()));
+ assertEquals(21474836480L, resolveMaxTLSSize(OptionalDouble.of(0.02), Optional.empty()));
+ assertEquals(7516192768L, resolveMaxTLSSize(OptionalDouble.empty(), Optional.of(flavor)));
+ assertEquals(2147483648L, resolveMaxTLSSize(OptionalDouble.of(0.02), Optional.of(flavor)));
+ assertEquals(3221225472L, resolveMaxTLSSize(OptionalDouble.of(0.03), Optional.of(flavor)));
+ }
+
void assertZookeeperServerImplementation(String expectedClassName,
ClusterControllerContainerCluster clusterControllerCluster) {
for (ClusterControllerContainer c : clusterControllerCluster.getContainers()) {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java
index 781266c8223..e2645e0b39e 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java
@@ -133,11 +133,13 @@ public class NodeResourcesTuningTest {
@Test
public void require_that_flush_strategy_tls_size_is_set_based_on_available_disk() {
- assertFlushStrategyTlsSize(7 * GB, 100);
- assertFlushStrategyTlsSize(35 * GB, 500);
- assertFlushStrategyTlsSize(84 * GB, 1200);
- assertFlushStrategyTlsSize(100 * GB, 1720);
- assertFlushStrategyTlsSize(100 * GB, 24000);
+ assertFlushStrategyTlsSize(2 * GB, 10, 0.05);
+ assertFlushStrategyTlsSize(7 * GB, 100, 0.07);
+ assertFlushStrategyTlsSize(5 * GB, 100, 0.05);
+ assertFlushStrategyTlsSize(35 * GB, 500, 0.07);
+ assertFlushStrategyTlsSize(84 * GB, 1200, 0.07);
+ assertFlushStrategyTlsSize(100 * GB, 1720, 0.07);
+ assertFlushStrategyTlsSize(100 * GB, 24000, 0.07);
}
@Test
@@ -178,8 +180,8 @@ public class NodeResourcesTuningTest {
assertEquals(expMemoryBytes, configFromMemorySetting(wantedMemoryGb + reservedMemoryGb, 0).flush().memory().each().maxmemory());
}
- private static void assertFlushStrategyTlsSize(long expTlsSizeBytes, int diskGb) {
- assertEquals(expTlsSizeBytes, configFromDiskSetting(diskGb).flush().memory().maxtlssize());
+ private static void assertFlushStrategyTlsSize(long expTlsSizeBytes, int diskGb, double tlsSizeFraction) {
+ assertEquals(expTlsSizeBytes, configFromDiskSetting(diskGb, tlsSizeFraction).flush().memory().maxtlssize());
}
private static void assertSummaryReadIo(ProtonConfig.Summary.Read.Io.Enum expValue, boolean fastDisk) {
@@ -199,51 +201,63 @@ public class NodeResourcesTuningTest {
}
private static ProtonConfig configFromDiskSetting(boolean fastDisk) {
- return getConfig(new FlavorsConfig.Flavor.Builder().fastDisk(fastDisk), 0);
+ return getConfig(new FlavorsConfig.Flavor.Builder().fastDisk(fastDisk));
}
private static ProtonConfig configFromDiskSetting(int diskGb) {
- return getConfig(new FlavorsConfig.Flavor.Builder().minDiskAvailableGb(diskGb), 0);
+ return configFromDiskSetting(diskGb, 0.07);
+ }
+ private static ProtonConfig configFromDiskSetting(int diskGb, double tlsSizeFraction) {
+ return getConfig(new FlavorsConfig.Flavor.Builder().minDiskAvailableGb(diskGb), 0, tlsSizeFraction);
}
private static ProtonConfig configFromMemorySetting(double memoryGb, double fractionOfMemoryReserved) {
- return getConfig(new FlavorsConfig.Flavor.Builder().minMainMemoryAvailableGb(memoryGb), fractionOfMemoryReserved);
+ return getConfig(new FlavorsConfig.Flavor.Builder().minMainMemoryAvailableGb(memoryGb), fractionOfMemoryReserved, 0.07);
}
private static ProtonConfig configFromMemorySetting(double memoryGb, ProtonConfig.Builder builder) {
return getConfig(new FlavorsConfig.Flavor.Builder()
- .minMainMemoryAvailableGb(memoryGb), builder, 0);
+ .minMainMemoryAvailableGb(memoryGb), builder);
}
private static ProtonConfig configFromNumCoresSetting(double numCores) {
- return getConfig(new FlavorsConfig.Flavor.Builder().minCpuCores(numCores), 0);
+ return getConfig(new FlavorsConfig.Flavor.Builder().minCpuCores(numCores));
}
private static ProtonConfig configFromNumCoresSetting(double numCores, int numThreadsPerSearch) {
return getConfig(new FlavorsConfig.Flavor.Builder().minCpuCores(numCores),
- new ProtonConfig.Builder(), numThreadsPerSearch, 0);
+ new ProtonConfig.Builder(), numThreadsPerSearch);
}
private static ProtonConfig configFromEnvironmentType(boolean docker) {
String environment = (docker ? "DOCKER_CONTAINER" : "undefined");
- return getConfig(new FlavorsConfig.Flavor.Builder().environment(environment), 0);
+ return getConfig(new FlavorsConfig.Flavor.Builder().environment(environment));
}
- private static ProtonConfig getConfig(FlavorsConfig.Flavor.Builder flavorBuilder, double fractionOfMemoryReserved) {
- return getConfig(flavorBuilder, new ProtonConfig.Builder(), fractionOfMemoryReserved);
+ private static ProtonConfig getConfig(FlavorsConfig.Flavor.Builder flavorBuilder) {
+ return getConfig(flavorBuilder, new ProtonConfig.Builder());
}
- private static ProtonConfig getConfig(FlavorsConfig.Flavor.Builder flavorBuilder, ProtonConfig.Builder protonBuilder, double fractionOfMemoryReserved) {
- flavorBuilder.name("my_flavor");
- NodeResourcesTuning tuning = new NodeResourcesTuning(new Flavor(new FlavorsConfig.Flavor(flavorBuilder)).resources(), 1, fractionOfMemoryReserved);
- tuning.getConfig(protonBuilder);
- return new ProtonConfig(protonBuilder);
+ private static ProtonConfig getConfig(FlavorsConfig.Flavor.Builder flavorBuilder, double fractionOfMemoryReserved, double tlsSizeFraction) {
+ return getConfig(flavorBuilder, new ProtonConfig.Builder(), fractionOfMemoryReserved, tlsSizeFraction);
+ }
+
+ private static ProtonConfig getConfig(FlavorsConfig.Flavor.Builder flavorBuilder, ProtonConfig.Builder protonBuilder) {
+ return getConfig(flavorBuilder, protonBuilder,1);
+ }
+ private static ProtonConfig getConfig(FlavorsConfig.Flavor.Builder flavorBuilder, ProtonConfig.Builder protonBuilder, double fractionOfMemoryReserved, double tlsSizeFraction) {
+ return getConfig(flavorBuilder, protonBuilder, 1, fractionOfMemoryReserved, tlsSizeFraction);
+ }
+
+ private static ProtonConfig getConfig(FlavorsConfig.Flavor.Builder flavorBuilder, ProtonConfig.Builder protonBuilder,
+ int numThreadsPerSearch) {
+ return getConfig(flavorBuilder, protonBuilder, numThreadsPerSearch, 0, 0.07);
}
private static ProtonConfig getConfig(FlavorsConfig.Flavor.Builder flavorBuilder, ProtonConfig.Builder protonBuilder,
- int numThreadsPerSearch, double fractionOfMemoryReserved) {
+ int numThreadsPerSearch, double fractionOfMemoryReserved, double tlsSizeFraction) {
flavorBuilder.name("my_flavor");
- NodeResourcesTuning tuning = new NodeResourcesTuning(new Flavor(new FlavorsConfig.Flavor(flavorBuilder)).resources(), numThreadsPerSearch, fractionOfMemoryReserved);
+ NodeResourcesTuning tuning = new NodeResourcesTuning(new Flavor(new FlavorsConfig.Flavor(flavorBuilder)).resources(), numThreadsPerSearch, fractionOfMemoryReserved, tlsSizeFraction);
tuning.getConfig(protonBuilder);
return new ProtonConfig(protonBuilder);
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaNodeTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaNodeTest.java
index e8781904786..9077fcea4d1 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaNodeTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaNodeTest.java
@@ -52,7 +52,9 @@ public class SchemaNodeTest {
private static SearchNode createSearchNode(MockRoot root, String name, int distributionKey,
NodeSpec nodeSpec, boolean flushOnShutDown, boolean isHosted) {
- return SearchNode.create(root, name, distributionKey, nodeSpec, "mycluster", null, flushOnShutDown, Optional.empty(), Optional.empty(), isHosted, 0.0);
+ return SearchNode.create(root, name, distributionKey, nodeSpec, "mycluster", null, flushOnShutDown,
+ Optional.empty(), Optional.empty(), isHosted, 0.0,
+ root.getDeployState().featureFlags().tlsSizeFraction());
}
private static SearchNode createSearchNode(MockRoot root) {
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java
index 978241339d2..063603fe8a8 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java
@@ -203,6 +203,8 @@ public class ModelContextImpl implements ModelContext {
private final boolean useV8GeoPositions;
private final boolean useV8DocManagerCfg;
private final int maxCompactBuffers;
+ private final boolean failDeploymentWithInvalidJvmOptions;
+ private final double tlsSizeFraction;
public FeatureFlags(FlagSource source, ApplicationId appId) {
this.defaultTermwiseLimit = flagValue(source, appId, Flags.DEFAULT_TERM_WISE_LIMIT);
@@ -244,6 +246,8 @@ public class ModelContextImpl implements ModelContext {
this.useV8GeoPositions = flagValue(source, appId, Flags.USE_V8_GEO_POSITIONS);
this.useV8DocManagerCfg = flagValue(source, appId, Flags.USE_V8_DOC_MANAGER_CFG);
this.maxCompactBuffers = flagValue(source, appId, Flags.MAX_COMPACT_BUFFERS);
+ this.failDeploymentWithInvalidJvmOptions = flagValue(source, appId, Flags.FAIL_DEPLOYMENT_WITH_INVALID_JVM_OPTIONS);
+ this.tlsSizeFraction = flagValue(source, appId, Flags.TLS_SIZE_FRACTION);
}
@Override public double defaultTermwiseLimit() { return defaultTermwiseLimit; }
@@ -286,6 +290,9 @@ public class ModelContextImpl implements ModelContext {
@Override public boolean unorderedMergeChaining() { return unorderedMergeChaining; }
@Override public boolean useV8GeoPositions() { return useV8GeoPositions; }
@Override public boolean useV8DocManagerCfg() { return useV8DocManagerCfg; }
+ @Override public boolean failDeploymentWithInvalidJvmOptions() { return failDeploymentWithInvalidJvmOptions; }
+ @Override public int maxCompactBuffers() { return maxCompactBuffers; }
+ @Override public double tlsSizeFraction() { return tlsSizeFraction; }
private static <V> V flagValue(FlagSource source, ApplicationId appId, UnboundFlag<? extends V, ?, ?> flag) {
return flag.bindTo(source)
diff --git a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/storagepolicy/ContentPolicyTestEnvironment.java b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/storagepolicy/ContentPolicyTestEnvironment.java
index c75e1c7832e..f0c54505bb1 100644
--- a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/storagepolicy/ContentPolicyTestEnvironment.java
+++ b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/storagepolicy/ContentPolicyTestEnvironment.java
@@ -44,7 +44,7 @@ public abstract class ContentPolicyTestEnvironment {
protected PolicyTestFrame frame;
private Set<Integer> nodes;
protected static int[] bucketOneNodePreference = new int[]{ 3, 5, 7, 6, 8, 0, 9, 2, 1, 4 };
- protected boolean debug = true;
+ protected boolean debug = false;
@Before
public void setUp() throws Exception {
diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java
index 97b06c802dd..e4a32e792e8 100644
--- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java
+++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java
@@ -52,6 +52,13 @@ public class Flags {
"Takes effect at redeployment",
ZONE_ID, APPLICATION_ID);
+ public static final UnboundDoubleFlag TLS_SIZE_FRACTION = defineDoubleFlag(
+ "tls-size-fraction", 0.07,
+ List.of("baldersheim"), "2021-12-20", "2022-02-01",
+ "Fraction of disk available for transaction log",
+ "Takes effect at redeployment",
+ ZONE_ID, APPLICATION_ID);
+
public static final UnboundStringFlag FEED_SEQUENCER_TYPE = defineStringFlag(
"feed-sequencer-type", "LATENCY",
List.of("baldersheim"), "2020-12-02", "2022-01-01",
@@ -386,6 +393,13 @@ public class Flags {
"Takes effect at redeployment",
ZONE_ID, APPLICATION_ID);
+ public static final UnboundBooleanFlag FAIL_DEPLOYMENT_WITH_INVALID_JVM_OPTIONS = defineFeatureFlag(
+ "fail-deployment-with-invalid-jvm-options", false,
+ List.of("hmusum"), "2021-12-20", "2022-01-20",
+ "Whether to fail deployments with invalid JVM options in services.xml",
+ "Takes effect at redeployment",
+ ZONE_ID, APPLICATION_ID);
+
/** WARNING: public for testing: All flags should be defined in {@link Flags}. */
public static UnboundBooleanFlag defineFeatureFlag(String flagId, boolean defaultValue, List<String> owners,
String createdAt, String expiresAt, String description,
diff --git a/parent/pom.xml b/parent/pom.xml
index b1dcaab2d83..1c24316a80b 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -865,7 +865,7 @@
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
- <version>2.12.0</version>
+ <version>2.12.1</version>
</dependency>
</dependencies>
</dependencyManagement>