diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-10-22 23:23:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-22 23:23:34 +0200 |
commit | eedcfc980db65da04eaca866693ef215f337f325 (patch) | |
tree | 9821df83fe52dd45cc0abdf14d4eb015a99fe3af | |
parent | fc55b0a198f9374f825b02c46e50d3d07f8fcabe (diff) | |
parent | 7b13c0627e3e46888433d97644750a88cde31016 (diff) |
Merge pull request #7407 from vespa-engine/revert-7397-revert-7391-balder/avoid-caching-stuff-you-already-have-access-t
Revert "Revert "Balder/avoid caching stuff you already have access t""
9 files changed, 55 insertions, 112 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java index ec8db5faa05..502df074ec4 100755 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java @@ -33,7 +33,6 @@ import com.yahoo.container.logging.AccessLog; import com.yahoo.container.usability.BindingsOverviewHandler; import com.yahoo.document.config.DocumentmanagerConfig; import com.yahoo.jdisc.http.ServletPathsConfig; -import com.yahoo.lang.SettableOptional; import com.yahoo.metrics.simple.runtime.MetricProperties; import com.yahoo.osgi.provider.model.ComponentModel; import com.yahoo.prelude.semantics.SemanticRulesConfig; @@ -167,7 +166,7 @@ public final class ContainerCluster private final List<String> serviceAliases = new ArrayList<>(); private final List<String> endpointAliases = new ArrayList<>(); - protected final ComponentGroup<Component<?, ?>> componentGroup; + private final ComponentGroup<Component<?, ?>> componentGroup; private final ConfigProducerGroup<RestApi> restApiGroup; private final ConfigProducerGroup<Servlet> servletGroup; private final ContainerClusterVerifier clusterVerifier; @@ -181,8 +180,8 @@ public final class ContainerCluster /** The zone this is deployed in, or the default zone if not on hosted Vespa */ private Zone zone; - private Optional<String> hostClusterId = Optional.empty(); - private final SettableOptional<Integer> memoryPercentage = new SettableOptional<>(); + private String hostClusterId = null; + private Integer memoryPercentage = null; private static class AcceptAllVerifier implements ContainerClusterVerifier { @Override @@ -326,7 +325,7 @@ public final class ContainerCluster return componentGroup.removeComponent(componentId); } - public void addSimpleComponent(Class<?> clazz) { + private void addSimpleComponent(Class<?> clazz) { addSimpleComponent(clazz.getName()); } @@ -413,7 +412,7 @@ public final class ContainerCluster addComponent(processingHandler); } - public ProcessingChains getProcessingChains() { + ProcessingChains getProcessingChains() { return processingChains; } @@ -775,22 +774,22 @@ public final class ContainerCluster /** The configured endpoint aliases (fqdn) for the service in this cluster */ public List<String> endpointAliases() { return endpointAliases; } - public void setHostClusterId(String clusterId) { hostClusterId = Optional.ofNullable(clusterId); } + public void setHostClusterId(String clusterId) { hostClusterId = clusterId; } /** * Returns the id of the content cluster which hosts this container cluster, if any. * This is only set with hosted clusters where this container cluster is set up to run on the nodes * of a content cluster. */ - public Optional<String> getHostClusterId() { return hostClusterId; } + public Optional<String> getHostClusterId() { return Optional.ofNullable(hostClusterId); } - public void setMemoryPercentage(Optional<Integer> memoryPercentage) { this.memoryPercentage.set(memoryPercentage); } + public void setMemoryPercentage(Integer memoryPercentage) { this.memoryPercentage = memoryPercentage; } /** * Returns the percentage of host physical memory this application has specified for nodes in this cluster, * or empty if this is not specified by the application. */ - public SettableOptional<Integer> getMemoryPercentage() { return memoryPercentage; } + public Optional<Integer> getMemoryPercentage() { return Optional.ofNullable(memoryPercentage); } boolean messageBusEnabled() { return messageBusEnabled; } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java index 227deca959f..2cfd4b067cd 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java @@ -1,10 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.container.search; -import com.yahoo.binaryprefix.BinaryPrefix; -import com.yahoo.binaryprefix.BinaryScaledAmount; import com.yahoo.container.bundle.BundleInstantiationSpecification; -import com.yahoo.lang.SettableOptional; import com.yahoo.osgi.provider.model.ComponentModel; import com.yahoo.prelude.fastsearch.FS4ResourcePool; import com.yahoo.prelude.semantics.SemanticRulesConfig; @@ -14,15 +11,21 @@ import com.yahoo.vespa.model.container.component.ContainerSubsystem; import com.yahoo.vespa.model.container.search.searchchain.HttpProvider; import com.yahoo.vespa.model.container.search.searchchain.LocalProvider; import com.yahoo.vespa.model.container.search.searchchain.SearchChains; -import com.yahoo.vespa.model.search.*; import com.yahoo.search.config.IndexInfoConfig; import com.yahoo.search.config.QrStartConfig; import com.yahoo.vespa.configdefinition.IlscriptsConfig; import com.yahoo.container.QrSearchersConfig; import com.yahoo.search.query.profile.config.QueryProfilesConfig; import com.yahoo.search.pagetemplates.PageTemplatesConfig; +import com.yahoo.vespa.model.search.AbstractSearchCluster; +import com.yahoo.vespa.model.search.Dispatch; +import com.yahoo.vespa.model.search.IndexedSearchCluster; +import com.yahoo.vespa.model.search.StreamingSearchCluster; -import java.util.*; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; /** * @author gjoranv @@ -41,20 +44,15 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> private final List<AbstractSearchCluster> systems = new LinkedList<>(); private final Options options; - // For legacy qrs clusters only. - private BinaryScaledAmount totalCacheSize = new BinaryScaledAmount(); - private QueryProfiles queryProfiles; private SemanticRules semanticRules; private PageTemplates pageTemplates; private final ContainerCluster owningCluster; - private final SettableOptional<Integer> memoryPercentage; public ContainerSearch(ContainerCluster cluster, SearchChains chains, Options options) { super(chains); this.options = options; this.owningCluster = cluster; - this.memoryPercentage = cluster.getMemoryPercentage(); cluster.addComponent(getFS4ResourcePool()); } @@ -71,7 +69,7 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> // public for testing public void initializeSearchChains(Map<String, ? extends AbstractSearchCluster> searchClusters) { - getChains().initialize(searchClusters, totalCacheSize); + getChains().initialize(searchClusters); QrsCache defaultCacheOptions = getOptions().cacheSettings.get(""); if (defaultCacheOptions != null) { @@ -88,10 +86,6 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> } } - public void setTotalCacheSize(BinaryScaledAmount totalCacheSize) { - this.totalCacheSize = totalCacheSize; - } - public void setQueryProfiles(QueryProfiles queryProfiles) { this.queryProfiles = queryProfiles; } @@ -122,24 +116,16 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> @Override public void getConfig(QrStartConfig.Builder qsB) { QrStartConfig.Jvm.Builder internalBuilder = new QrStartConfig.Jvm.Builder(); - if (memoryPercentage.isPresent()) { - internalBuilder.heapSizeAsPercentageOfPhysicalMemory(memoryPercentage.get()); - } - else if (owningCluster.isHostedVespa()) { - if (owningCluster.getHostClusterId().isPresent()) - internalBuilder.heapSizeAsPercentageOfPhysicalMemory(17); - else - internalBuilder.heapSizeAsPercentageOfPhysicalMemory(60); + if (owningCluster.getMemoryPercentage().isPresent()) { + internalBuilder.heapSizeAsPercentageOfPhysicalMemory(owningCluster.getMemoryPercentage().get()); + } else if (owningCluster.isHostedVespa()) { + internalBuilder.heapSizeAsPercentageOfPhysicalMemory(owningCluster.getHostClusterId().isPresent() ? 17 : 60); } qsB.jvm(internalBuilder.directMemorySizeCache(totalCacheSizeMb())); } private int totalCacheSizeMb() { - if (!totalCacheSize.equals(new BinaryScaledAmount())) { - return (int) totalCacheSize.as(BinaryPrefix.mega); - } else { - return totalHttpProviderCacheSize(); - } + return totalHttpProviderCacheSize(); } private int totalHttpProviderCacheSize() { @@ -201,7 +187,6 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> public Options getOptions() { return options; } - public Optional<Integer> getMemoryPercentage() { return memoryPercentage.asOptional(); } /** * Struct that encapsulates qrserver options. diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/HttpProvider.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/HttpProvider.java index 983f903310f..62b2f2ccbc6 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/HttpProvider.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/HttpProvider.java @@ -28,20 +28,6 @@ public class HttpProvider extends Provider implements ProviderConfig.Producer, @SuppressWarnings("deprecation") private final com.yahoo.search.searchchain.model.federation.HttpProviderSpec providerSpec; - //TODO: For backward compatibility only, eliminate this later - private BinaryScaledAmount cacheSize; - - public double getCacheWeight() { - return providerSpec.cacheWeight; - } - - /** - * TODO: remove, for backward compatibility only. - */ - public void setCacheSize(BinaryScaledAmount cacheSize) { - this.cacheSize = cacheSize; - } - /* * Config producer for the contained http searcher.. */ @@ -101,9 +87,7 @@ public class HttpProvider extends Provider implements ProviderConfig.Producer, } public int cacheSizeMB() { - return providerSpec.cacheSizeMB != null ? - providerSpec.cacheSizeMB : - (int) cacheSize.as(BinaryPrefix.mega); + return providerSpec.cacheSizeMB != null ? providerSpec.cacheSizeMB : 0; } @Override diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/SearchChains.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/SearchChains.java index c5913528435..42d81e19496 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/SearchChains.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/SearchChains.java @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.container.search.searchchain; -import com.yahoo.binaryprefix.BinaryScaledAmount; import com.yahoo.collections.CollectionUtil; import com.yahoo.component.provider.ComponentRegistry; import com.yahoo.config.model.producer.AbstractConfigProducer; @@ -26,33 +25,19 @@ public class SearchChains extends Chains<SearchChain> { super(parent, subId); } - public void initialize(Map<String, ? extends AbstractSearchCluster> searchClustersByName, BinaryScaledAmount totalProviderCacheSize) { + public void initialize(Map<String, ? extends AbstractSearchCluster> searchClustersByName) { LocalClustersCreator.addDefaultLocalProviders(this, searchClustersByName.keySet()); VespaSearchChainsCreator.addVespaSearchChains(this); validateSourceGroups(); //must be done before initializing searchers since they are used by FederationSearchers. - initializeComponents(searchClustersByName, totalProviderCacheSize); + initializeComponents(searchClustersByName); } - private void initializeComponents(Map<String, ? extends AbstractSearchCluster> searchClustersByName, - BinaryScaledAmount totalProviderCacheSize) { + private void initializeComponents(Map<String, ? extends AbstractSearchCluster> searchClustersByName) { setSearchClusterForLocalProvider(searchClustersByName); - setCacheSizeForHttpProviders(totalProviderCacheSize); initializeComponents(); } - private void setCacheSizeForHttpProviders(BinaryScaledAmount totalProviderCacheSize) { - double totalCacheWeight = 0; - for (HttpProvider provider : httpProviders()) { - totalCacheWeight += provider.getCacheWeight(); - } - - final BinaryScaledAmount cacheUnit = totalProviderCacheSize.divide(totalCacheWeight); - for (HttpProvider provider : httpProviders()) { - provider.setCacheSize(cacheUnit.multiply(provider.getCacheWeight())); - } - } - private void setSearchClusterForLocalProvider(Map<String, ? extends AbstractSearchCluster> clusterIndexByName) { for (LocalProvider provider : localProviders()) { AbstractSearchCluster cluster = clusterIndexByName.get(provider.getClusterName()); @@ -81,7 +66,7 @@ public class SearchChains extends Chains<SearchChain> { super.validate(); } - public SourceGroupRegistry allSourceGroups() { + SourceGroupRegistry allSourceGroups() { return sourceGroups; } 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 80026d0182e..89f2995d179 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 @@ -136,7 +136,7 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { model.setCluster(cluster); } - protected void addBundlesForPlatformComponents(ContainerCluster cluster) { + private void addBundlesForPlatformComponents(ContainerCluster cluster) { for (Component<?, ?> component : cluster.getAllComponents()) { String componentClass = component.model.bundleInstantiationSpec.getClassName(); BundleMapper.getBundlePath(componentClass). @@ -252,15 +252,15 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { addConfiguredComponents(deployState, cluster, spec, "component"); } - protected void setDefaultMetricConsumerFactory(ContainerCluster cluster) { + private void setDefaultMetricConsumerFactory(ContainerCluster cluster) { cluster.setDefaultMetricConsumerFactory(MetricDefaultsConfig.Factory.Enum.STATE_MONITOR); } - protected void addDefaultHandlers(ContainerCluster cluster) { + private void addDefaultHandlers(ContainerCluster cluster) { addDefaultHandlersExceptStatus(cluster); } - protected void addStatusHandlers(ContainerCluster cluster, ConfigModelContext configModelContext) { + private void addStatusHandlers(ContainerCluster cluster, ConfigModelContext configModelContext) { if (configModelContext.getDeployState().isHosted()) { String name = "status.html"; Optional<String> statusFile = Optional.ofNullable(System.getenv(HOSTED_VESPA_STATUS_FILE_INSTALL_SETTING)); @@ -281,7 +281,7 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { cluster.addVipHandler(); } - protected static void addDefaultHandlersExceptStatus(ContainerCluster cluster) { + private static void addDefaultHandlersExceptStatus(ContainerCluster cluster) { cluster.addDefaultRootHandler(); cluster.addMetricStateHandler(); cluster.addApplicationStatusHandler(); @@ -313,7 +313,7 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { return components; } - protected void addAccessLogs(DeployState deployState, ContainerCluster cluster, Element spec) { + private void addAccessLogs(DeployState deployState, ContainerCluster cluster, Element spec) { List<Element> accessLogElements = getAccessLogElements(spec); for (Element accessLog : accessLogElements) { @@ -324,12 +324,12 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { cluster.addDefaultSearchAccessLog(); } - protected final List<Element> getAccessLogElements(Element spec) { + private List<Element> getAccessLogElements(Element spec) { return XML.getChildren(spec, "accesslog"); } - protected final void addHttp(DeployState deployState, Element spec, ContainerCluster cluster) { + private void addHttp(DeployState deployState, Element spec, ContainerCluster cluster) { Element httpElement = XML.getChild(spec, "http"); if (httpElement != null) { cluster.setHttp(buildHttp(deployState, cluster, httpElement)); @@ -345,7 +345,7 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { return http; } - protected void addRestApis(DeployState deployState, Element spec, ContainerCluster cluster) { + private void addRestApis(DeployState deployState, Element spec, ContainerCluster cluster) { for (Element restApiElem : XML.getChildren(spec, "rest-api")) { cluster.addRestApi( new RestApiBuilder().build(deployState, cluster, restApiElem)); @@ -505,7 +505,7 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { memoryPercentage = memoryPercentage.substring(0, memoryPercentage.length()-1).trim(); try { - cluster.setMemoryPercentage(Optional.of(Integer.parseInt(memoryPercentage))); + cluster.setMemoryPercentage(Integer.parseInt(memoryPercentage)); } catch (NumberFormatException e) { throw new IllegalArgumentException("The memory percentage given for nodes in " + cluster + @@ -758,13 +758,13 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { } } - public static void addConfiguredComponents(DeployState deployState, ContainerCluster cluster, Element spec, String componentName) { + private static void addConfiguredComponents(DeployState deployState, ContainerCluster cluster, Element spec, String componentName) { for (Element node : XML.getChildren(spec, componentName)) { cluster.addComponent(new DomComponentBuilder().build(deployState, cluster, node)); } } - public static void validateAndAddConfiguredComponents(DeployState deployState, ContainerCluster cluster, Element spec, String componentName, Consumer<Element> elementValidator) { + private static void validateAndAddConfiguredComponents(DeployState deployState, ContainerCluster cluster, Element spec, String componentName, Consumer<Element> elementValidator) { for (Element node : XML.getChildren(spec, componentName)) { elementValidator.accept(node); // throws exception here if something is wrong cluster.addComponent(new DomComponentBuilder().build(deployState, cluster, node)); diff --git a/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java b/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java index d4a11052a71..4a9a6d3dff3 100644 --- a/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java +++ b/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java @@ -132,13 +132,13 @@ public class ModelProvisioningTest { assertThat(model.getContainerClusters().get("mydisc").getContainers().get(0).getPreLoad(), is(getDefaults().underVespaHome("lib64/vespa/malloc/libvespamalloc.so"))); assertThat(model.getContainerClusters().get("mydisc").getContainers().get(1).getPreLoad(), is(getDefaults().underVespaHome("lib64/vespa/malloc/libvespamalloc.so"))); assertThat(model.getContainerClusters().get("mydisc").getContainers().get(2).getPreLoad(), is(getDefaults().underVespaHome("lib64/vespa/malloc/libvespamalloc.so"))); - assertThat(model.getContainerClusters().get("mydisc").getMemoryPercentage().asOptional(), is(Optional.empty())); + assertThat(model.getContainerClusters().get("mydisc").getMemoryPercentage(), is(Optional.empty())); assertThat(model.getContainerClusters().get("mydisc2").getContainers().get(0).getJvmArgs(), is("-verbosegc")); assertThat(model.getContainerClusters().get("mydisc2").getContainers().get(1).getJvmArgs(), is("-verbosegc")); assertThat(model.getContainerClusters().get("mydisc2").getContainers().get(0).getPreLoad(), is("lib/blablamalloc.so")); assertThat(model.getContainerClusters().get("mydisc2").getContainers().get(1).getPreLoad(), is("lib/blablamalloc.so")); - assertThat(model.getContainerClusters().get("mydisc2").getMemoryPercentage().asOptional(), is(Optional.of(45))); + assertThat(model.getContainerClusters().get("mydisc2").getMemoryPercentage(), is(Optional.of(45))); QrStartConfig.Builder qrStartBuilder = new QrStartConfig.Builder(); model.getContainerClusters().get("mydisc2").getConfig(qrStartBuilder); QrStartConfig qrsStartConfig = new QrStartConfig(qrStartBuilder); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java index 6067494dec9..8e096b14d85 100755 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java @@ -89,7 +89,7 @@ public class ContainerClusterTest { } private ContainerCluster createContainerCluster(MockRoot root, boolean isCombinedCluster) { - return createContainerCluster(root, isCombinedCluster, Optional.empty(), Optional.empty()); + return createContainerCluster(root, isCombinedCluster, null, Optional.empty()); } private ContainerCluster createClusterControllerCluster(MockRoot root) { @@ -97,11 +97,10 @@ public class ContainerClusterTest { } private ContainerCluster createContainerCluster(MockRoot root, boolean isCombinedCluster, ContainerClusterVerifier extraComponents) { - return createContainerCluster(root, isCombinedCluster, Optional.empty(), Optional.of(extraComponents)); + return createContainerCluster(root, isCombinedCluster, null, Optional.of(extraComponents)); } - private ContainerCluster createContainerCluster(MockRoot root, boolean isCombinedCluster, - Optional<Integer> memoryPercentage) { + private ContainerCluster createContainerCluster(MockRoot root, boolean isCombinedCluster, Integer memoryPercentage) { return createContainerCluster(root, isCombinedCluster, memoryPercentage, Optional.empty()); } private MockRoot createRoot(boolean isHosted) { @@ -109,7 +108,7 @@ public class ContainerClusterTest { return new MockRoot("foo", state); } private ContainerCluster createContainerCluster(MockRoot root, boolean isCombinedCluster, - Optional<Integer> memoryPercentage, Optional<ContainerClusterVerifier> extraComponents) { + Integer memoryPercentage, Optional<ContainerClusterVerifier> extraComponents) { ContainerCluster cluster = extraComponents.isPresent() ? new ContainerCluster(root, "container0", "container1", extraComponents.get(), root.getDeployState()) @@ -121,7 +120,7 @@ public class ContainerClusterTest { return cluster; } private void verifyHeapSizeAsPercentageOfPhysicalMemory(boolean isHosted, boolean isCombinedCluster, - Optional<Integer> explicitMemoryPercentage, + Integer explicitMemoryPercentage, int expectedMemoryPercentage) { ContainerCluster cluster = createContainerCluster(createRoot(isHosted), isCombinedCluster, explicitMemoryPercentage); QrStartConfig.Builder qsB = new QrStartConfig.Builder(); @@ -134,14 +133,14 @@ public class ContainerClusterTest { public void requireThatHeapSizeAsPercentageOfPhysicalMemoryForHostedAndNot() { boolean hosted = true; boolean combined = true; // a cluster running on content nodes (only relevant with hosted) - verifyHeapSizeAsPercentageOfPhysicalMemory( hosted, ! combined, Optional.empty(), 60); - verifyHeapSizeAsPercentageOfPhysicalMemory( hosted, combined, Optional.empty(), 17); - verifyHeapSizeAsPercentageOfPhysicalMemory(! hosted, ! combined, Optional.empty(), 0); + verifyHeapSizeAsPercentageOfPhysicalMemory( hosted, ! combined, null, 60); + verifyHeapSizeAsPercentageOfPhysicalMemory( hosted, combined, null, 17); + verifyHeapSizeAsPercentageOfPhysicalMemory(! hosted, ! combined, null, 0); // Explicit value overrides all defaults - verifyHeapSizeAsPercentageOfPhysicalMemory( hosted, ! combined, Optional.of(67), 67); - verifyHeapSizeAsPercentageOfPhysicalMemory( hosted, combined, Optional.of(68), 68); - verifyHeapSizeAsPercentageOfPhysicalMemory(! hosted, ! combined, Optional.of(69), 69); + verifyHeapSizeAsPercentageOfPhysicalMemory( hosted, ! combined, 67, 67); + verifyHeapSizeAsPercentageOfPhysicalMemory( hosted, combined, 68, 68); + verifyHeapSizeAsPercentageOfPhysicalMemory(! hosted, ! combined, 69, 69); } private void verifyJvmArgs(boolean isHosted, boolean hasDocproc, String expectedArgs, String jvmArgs) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/search/searchchain/SearchChainsTestBase.java b/config-model/src/test/java/com/yahoo/vespa/model/container/search/searchchain/SearchChainsTestBase.java index 9f7cbfd9a5b..51a8333ef6e 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/search/searchchain/SearchChainsTestBase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/search/searchchain/SearchChainsTestBase.java @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.container.search.searchchain; -import com.yahoo.binaryprefix.BinaryPrefix; import com.yahoo.binaryprefix.BinaryScaledAmount; import com.yahoo.config.model.builder.xml.test.DomBuilderTest; import com.yahoo.vespa.model.builder.xml.dom.chains.search.DomSearchChainsBuilder; @@ -16,8 +15,7 @@ public abstract class SearchChainsTestBase extends DomBuilderTest { @Before public void setupSearchChains() { SearchChains searchChains = new DomSearchChainsBuilder().build(root.getDeployState(), root, servicesXml()); - searchChains.initialize(MockSearchClusters.twoMockClusterSpecsByName(root), - new BinaryScaledAmount(100, BinaryPrefix.mega)); + searchChains.initialize(MockSearchClusters.twoMockClusterSpecsByName(root)); root.freezeModelTopology(); } diff --git a/container-search/src/main/java/com/yahoo/search/searchchain/model/federation/HttpProviderSpec.java b/container-search/src/main/java/com/yahoo/search/searchchain/model/federation/HttpProviderSpec.java index d38c481e33b..a679b17b6fc 100644 --- a/container-search/src/main/java/com/yahoo/search/searchchain/model/federation/HttpProviderSpec.java +++ b/container-search/src/main/java/com/yahoo/search/searchchain/model/federation/HttpProviderSpec.java @@ -76,10 +76,6 @@ public class HttpProviderSpec { public final Integer ycaRetryWait; public final Node ycaProxy; - //TODO:remove this - public final double cacheWeight; - - public static BundleInstantiationSpecification toBundleInstantiationSpecification(Type type) { return BundleInstantiationSpecification.getInternalSearcherSpecificationFromStrings(type.className, null); } @@ -103,9 +99,6 @@ public class HttpProviderSpec { Integer cacheSizeMB, ConnectionParameters connectionParameters) { - final double defaultCacheWeight = 1.0d; - this.cacheWeight = (cacheWeight != null) ? cacheWeight : defaultCacheWeight; - this.path = path; this.nodes = unmodifiable(nodes); this.ycaApplicationId = ycaApplicationId; @@ -119,7 +112,7 @@ public class HttpProviderSpec { private List<HttpProviderSpec.Node> unmodifiable(List<HttpProviderSpec.Node> nodes) { return nodes == null ? - Collections.<HttpProviderSpec.Node>emptyList() : + Collections.emptyList() : Collections.unmodifiableList(new ArrayList<>(nodes)); } } |