diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-04-29 09:35:44 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-04-29 09:35:44 +0200 |
commit | 2a7e2027f1e3cd4643b35bbac412f65f305d994c (patch) | |
tree | f15d99b87a1686b385d3006d96d32b50835add0c | |
parent | ed25d1bffcfe410e4806402db41fa9b9654c61ca (diff) |
GC unused config
7 files changed, 15 insertions, 137 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java b/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java index 8881162394b..e664ba56d01 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java @@ -16,7 +16,7 @@ import java.util.Collections; */ public class ContainerDocumentApi implements FeederConfig.Producer { - public static final String vespaClientBundleSpecification = "vespaclient-container-plugin"; + private static final String vespaClientBundleSpecification = "vespaclient-container-plugin"; private final Options options; public ContainerDocumentApi(ContainerCluster cluster, Options options) { @@ -29,7 +29,7 @@ public class ContainerDocumentApi implements FeederConfig.Producer { cluster.addComponent(newVespaClientHandler("com.yahoo.vespa.http.server.FeedHandler", ContainerCluster.RESERVED_URI_PREFIX + "/feedapi")); } - private Handler newVespaClientHandler(String componentId, String bindingSuffix) { + private Handler<AbstractConfigProducer<?>> newVespaClientHandler(String componentId, String bindingSuffix) { Handler<AbstractConfigProducer<?>> handler = new Handler<>(new ComponentModel( BundleInstantiationSpecification.getFromStrings(componentId, null, vespaClientBundleSpecification), "")); @@ -48,8 +48,6 @@ public class ContainerDocumentApi implements FeederConfig.Producer { builder.route(options.route); if (options.maxpendingdocs != null) builder.maxpendingdocs(options.maxpendingdocs); - if (options.maxpendingbytes != null) - builder.maxpendingbytes(options.maxpendingbytes); if (options.retryenabled != null) builder.retryenabled(options.retryenabled); if (options.timeout != null) @@ -58,8 +56,6 @@ public class ContainerDocumentApi implements FeederConfig.Producer { builder.tracelevel(options.tracelevel); if (options.mbusport != null) builder.mbusport(options.mbusport); - if (options.docprocChain != null) - builder.docprocchain(options.docprocChain); } public static final class Options { @@ -67,37 +63,28 @@ public class ContainerDocumentApi implements FeederConfig.Producer { private final Boolean abortondocumenterror; private final String route; private final Integer maxpendingdocs; - private final Integer maxpendingbytes; private final Boolean retryenabled; - private final Double retrydelay; private final Double timeout; private final Integer tracelevel; private final Integer mbusport; - private final String docprocChain; public Options(Collection<String> bindings, Boolean abortondocumenterror, String route, Integer maxpendingdocs, - Integer maxpendingbytes, Boolean retryenabled, - Double retrydelay, Double timeout, Integer tracelevel, - Integer mbusport, - String docprocChain) { + Integer mbusport) { this.bindings = Collections.unmodifiableCollection(bindings); this.abortondocumenterror = abortondocumenterror; this.route = route; this.maxpendingdocs = maxpendingdocs; - this.maxpendingbytes = maxpendingbytes; this.retryenabled = retryenabled; - this.retrydelay = retrydelay; this.timeout = timeout; this.tracelevel = tracelevel; this.mbusport = mbusport; - this.docprocChain = docprocChain; } } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/DocumentApiOptionsBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/DocumentApiOptionsBuilder.java index 10e24a609f7..4602e09eed4 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/DocumentApiOptionsBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/DocumentApiOptionsBuilder.java @@ -26,13 +26,10 @@ public class DocumentApiOptionsBuilder { getAbortOnDocumentError(spec), getRoute(spec), getMaxPendingDocs(spec), - getMaxPendingBytes(spec), getRetryEnabled(spec), - getRetryDelay(spec), getTimeout(spec), getTracelevel(spec), - getMbusPort(spec), - getDocprocChain(spec)); + getMbusPort(spec)); } private static List<String> getBindings(Element spec) { @@ -70,10 +67,6 @@ public class DocumentApiOptionsBuilder { return value.isEmpty() ? null : value; } - private static String getDocprocChain(Element spec) { - return getCleanValue(spec, "docprocchain"); - } - private static Integer getMbusPort(Element spec) { String value = getCleanValue(spec, "mbusport"); return value == null ? null : Integer.parseInt(value); @@ -89,21 +82,11 @@ public class DocumentApiOptionsBuilder { return value == null ? null : Double.parseDouble(value); } - private static Double getRetryDelay(Element spec) { - String value = getCleanValue(spec, "retrydelay"); - return value == null ? null : Double.parseDouble(value); - } - private static Boolean getRetryEnabled(Element spec) { String value = getCleanValue(spec, "retryenabled"); return value == null ? null : Boolean.parseBoolean(value); } - private static Integer getMaxPendingBytes(Element spec) { - String value = getCleanValue(spec, "maxpendingbytes"); - return value == null ? null : Integer.parseInt(value); - } - private static Integer getMaxPendingDocs(Element spec) { String value = getCleanValue(spec, "maxpendingdocs"); return value == null ? null : Integer.parseInt(value); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java index 5b92934678d..c36114edc5c 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java @@ -42,7 +42,6 @@ public class ContainerDocumentApiBuilderTest extends ContainerModelBuilderTestBa " <document-api>", " <abortondocumenterror>false</abortondocumenterror>", " <maxpendingdocs>4321</maxpendingdocs>", - " <retrydelay>12.34</retrydelay>", " <route>non-default</route>", " </document-api>", nodesXml, @@ -54,7 +53,6 @@ public class ContainerDocumentApiBuilderTest extends ContainerModelBuilderTestBa FeederConfig config = new FeederConfig(builder); assertThat(config.abortondocumenterror(), is(false)); assertThat(config.maxpendingdocs(), is(4321)); - assertThat(config.retrydelay(), is(12.34)); assertThat(config.route(), is("non-default")); } diff --git a/vespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java b/vespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java index ecfd3c9eded..25ef7651e28 100755 --- a/vespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java +++ b/vespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java @@ -22,14 +22,12 @@ public class FeederOptions { private boolean abortOnSendError = true; private boolean retryEnabled = true; private double timeout = 60; - private int maxPendingBytes = 0; private int maxPendingDocs = 0; private double maxFeedRate = 0.0; private String route = "default"; private int traceLevel; private int mbusPort; private DocumentProtocol.Priority priority = DocumentProtocol.Priority.NORMAL_3; - private String docprocChain = ""; /** Constructs an options object with all default values. */ FeederOptions() { @@ -40,14 +38,12 @@ public class FeederOptions { FeederOptions(FeederConfig config) { setAbortOnDocumentError(config.abortondocumenterror()); setAbortOnSendError(config.abortonsenderror()); - setMaxPendingBytes(config.maxpendingbytes()); setMaxPendingDocs(config.maxpendingdocs()); setRetryEnabled(config.retryenabled()); setRoute(config.route()); setTimeout(config.timeout()); setTraceLevel(config.tracelevel()); setMessageBusPort(config.mbusport()); - setDocprocChain(config.docprocchain()); setMaxFeedRate(config.maxfeedrate()); } @@ -71,10 +67,6 @@ public class FeederOptions { this.timeout = timeout; } - private void setMaxPendingBytes(int maxPendingBytes) { - this.maxPendingBytes = maxPendingBytes; - } - private void setMaxPendingDocs(int maxPendingDocs) { this.maxPendingDocs = maxPendingDocs; } @@ -123,14 +115,6 @@ public class FeederOptions { this.priority = priority; } - String getDocprocChain() { - return docprocChain; - } - - private void setDocprocChain(String chain) { - docprocChain = chain; - } - /** * Creates a source session params object with parameters set as these options * dictate. @@ -141,7 +125,7 @@ public class FeederOptions { StaticThrottlePolicy policy; if (maxFeedRate > 0.0) { policy = new RateThrottlingPolicy(maxFeedRate); - } else if ((maxPendingDocs == 0) && (maxPendingBytes == 0)) { + } else if (maxPendingDocs == 0) { policy = new DynamicThrottlePolicy(); } else { policy = new StaticThrottlePolicy(); @@ -149,9 +133,6 @@ public class FeederOptions { if (maxPendingDocs > 0) { policy.setMaxPendingCount(maxPendingDocs); } - if (maxPendingBytes > 0) { - policy.setMaxPendingSize(maxPendingBytes); - } params.setThrottlePolicy(policy); @@ -179,13 +160,11 @@ public class FeederOptions { ", abortOnSendError=" + abortOnSendError + ", retryEnabled=" + retryEnabled + ", timeout=" + timeout + - ", maxPendingBytes=" + maxPendingBytes + ", maxPendingDocs=" + maxPendingDocs + ", route='" + route + '\'' + ", traceLevel=" + traceLevel + ", mbusPort=" + mbusPort + ", priority=" + priority.name() + - ", docprocChain='" + docprocChain + '\'' + '}'; } @@ -198,14 +177,12 @@ public class FeederOptions { if (abortOnDocumentError != that.abortOnDocumentError) return false; if (abortOnSendError != that.abortOnSendError) return false; - if (maxPendingBytes != that.maxPendingBytes) return false; if (maxPendingDocs != that.maxPendingDocs) return false; if (maxFeedRate != that.maxFeedRate) return false; if (mbusPort != that.mbusPort) return false; if (retryEnabled != that.retryEnabled) return false; if (Double.compare(that.timeout, timeout) != 0) return false; if (traceLevel != that.traceLevel) return false; - if (docprocChain != null ? !docprocChain.equals(that.docprocChain) : that.docprocChain != null) return false; if (priority != that.priority) return false; if (route != null ? !route.equals(that.route) : that.route != null) return false; @@ -221,14 +198,12 @@ public class FeederOptions { result = 31 * result + (retryEnabled ? 1 : 0); temp = timeout != +0.0d ? Double.doubleToLongBits(timeout) : 0L; result = 31 * result + (int) (temp ^ (temp >>> 32)); - result = 31 * result + maxPendingBytes; result = 31 * result + maxPendingDocs; result = 31 * result + ((int)(maxFeedRate * 1000)); result = 31 * result + (route != null ? route.hashCode() : 0); result = 31 * result + traceLevel; result = 31 * result + mbusPort; result = 31 * result + (priority != null ? priority.hashCode() : 0); - result = 31 * result + (docprocChain != null ? docprocChain.hashCode() : 0); return result; } } diff --git a/vespaclient-core/src/main/java/com/yahoo/feedapi/MessagePropertyProcessor.java b/vespaclient-core/src/main/java/com/yahoo/feedapi/MessagePropertyProcessor.java index 11688ba62e4..74a4f916c07 100644 --- a/vespaclient-core/src/main/java/com/yahoo/feedapi/MessagePropertyProcessor.java +++ b/vespaclient-core/src/main/java/com/yahoo/feedapi/MessagePropertyProcessor.java @@ -1,20 +1,15 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.feedapi; -import com.yahoo.component.provider.ComponentRegistry; import com.yahoo.concurrent.SystemTimer; import com.yahoo.config.subscription.ConfigSubscriber; import com.yahoo.container.jdisc.HttpRequest; import com.yahoo.vespa.config.content.LoadTypeConfig; -import com.yahoo.container.Container; -import com.yahoo.docproc.DocprocService; -import com.yahoo.docproc.jdisc.DocumentProcessingHandler; import com.yahoo.documentapi.VisitorParameters; import com.yahoo.documentapi.messagebus.loadtypes.LoadType; import com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet; import com.yahoo.documentapi.messagebus.protocol.DocumentMessage; import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol; -import com.yahoo.jdisc.handler.RequestHandler; import com.yahoo.log.LogLevel; import com.yahoo.messagebus.Message; import com.yahoo.messagebus.routing.Route; @@ -29,6 +24,8 @@ import java.util.logging.Logger; public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscriber<FeederConfig> { private static final Logger log = Logger.getLogger(MessagePropertyProcessor.class.getName()); + private static final boolean defaultCreateIfNonExistent = false; + private FeederOptions feederOptions = null; private Route defaultRoute = null; private long defaultTimeoutMillis = 0; @@ -36,8 +33,7 @@ public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscrib private String defaultDocprocChain = null; private boolean defaultAbortOnDocumentError = true; private boolean defaultAbortOnSendError = true; - private boolean defaultCreateIfNonExistent = false; - private LoadTypeSet loadTypes = null; + private final LoadTypeSet loadTypes; private boolean configChanged = false; @@ -50,50 +46,6 @@ public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscrib defaultRoute = Route.parse(routeOverride); } - private synchronized String getDocprocChainParameter(HttpRequest request) { - String docprocChainParam = request.getProperty("docprocchain"); - return (docprocChainParam == null ? defaultDocprocChain : docprocChainParam); - } - - public synchronized DocprocService getDocprocChain(HttpRequest request) { - ComponentRegistry<DocprocService> services = getDocprocServiceRegistry(request); - - String docprocChain = getDocprocChainParameter(request); - if (docprocChain == null) { - return null; - } - - return services.getComponent(docprocChain); - } - - public synchronized ComponentRegistry<DocprocService> getDocprocServiceRegistry(HttpRequest request) { - String docprocChain = getDocprocChainParameter(request); - if (docprocChain == null) { - return null; - } - - Container container = Container.get(); - if (container == null) { - throw new IllegalStateException("Could not get Container instance."); - } - - ComponentRegistry<RequestHandler> requestHandlerRegistry = container.getRequestHandlerRegistry(); - if (requestHandlerRegistry == null) { - throw new IllegalStateException("Could not get requesthandlerregistry."); - } - - DocumentProcessingHandler handler = (DocumentProcessingHandler) requestHandlerRegistry - .getComponent(DocumentProcessingHandler.class.getName()); - if (handler == null) { - return null; - } - ComponentRegistry<DocprocService> services = handler.getDocprocServiceRegistry(); - if (services == null) { - throw new IllegalStateException("Could not get DocprocServiceRegistry."); - } - return services; - } - public PropertySetter buildPropertySetter(HttpRequest request) { String routeParam = null; double timeoutParam = -1; @@ -163,15 +115,15 @@ public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscrib public long getDefaultTimeoutMillis() { return defaultTimeoutMillis; } - public synchronized boolean configChanged() { + synchronized boolean configChanged() { return configChanged; } - public synchronized void setConfigChanged(boolean configChanged) { + synchronized void setConfigChanged(boolean configChanged) { this.configChanged = configChanged; } - public synchronized FeederOptions getFeederOptions() { + synchronized FeederOptions getFeederOptions() { return feederOptions; } @@ -180,7 +132,7 @@ public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscrib configure(config); } - public LoadTypeSet getLoadTypes() { + LoadTypeSet getLoadTypes() { return loadTypes; } @@ -200,12 +152,6 @@ public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscrib defaultAbortOnDocumentError = feederOptions.abortOnDocumentError(); defaultAbortOnSendError = feederOptions.abortOnSendError(); - if (!"".equals(feederOptions.getDocprocChain())) { - defaultDocprocChain = feederOptions.getDocprocChain(); - } else { - defaultDocprocChain = null; - } - if (log.isLoggable(LogLevel.DEBUG)) { log.log(LogLevel.DEBUG, "Received new config (" + "route: " + (defaultRoute != null ? defaultRoute : "<none>") + @@ -232,9 +178,9 @@ public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscrib private LoadType loadType; private int traceLevel; - public PropertySetter(Route route, long timeout, long totalTimeout, DocumentProtocol.Priority priority, LoadType loadType, - boolean retryEnabled, boolean abortOnDocumentError, boolean abortOnFeedError, - boolean createIfNonExistent, int traceLevel) { + PropertySetter(Route route, long timeout, long totalTimeout, DocumentProtocol.Priority priority, LoadType loadType, + boolean retryEnabled, boolean abortOnDocumentError, boolean abortOnFeedError, + boolean createIfNonExistent, int traceLevel) { this.route = route; this.timeout = timeout; this.totalTimeout = totalTimeout; diff --git a/vespaclient-core/src/main/resources/configdefinitions/feeder.def b/vespaclient-core/src/main/resources/configdefinitions/feeder.def index 2c95cf25398..e138be715d5 100644 --- a/vespaclient-core/src/main/resources/configdefinitions/feeder.def +++ b/vespaclient-core/src/main/resources/configdefinitions/feeder.def @@ -11,12 +11,6 @@ abortonsenderror bool default=true ## Max number of pending operations. maxpendingdocs int default=0 -## Max number of bytes in pending operations. -maxpendingbytes int default=0 - -## Max number of busy threads -maxbusythreads int default=150 - ## Max number of operations to perform per second (0 == no max) maxfeedrate double default=0.0 @@ -35,8 +29,5 @@ tracelevel int default=0 ## Messagebus port to start source session on mbusport int default=-1 -## Default docproc chain to run -docprocchain string default="" - ## Whether or not to set create-if-non-existent flag on all document updates handled by a feeder. createifnonexistent bool default=false diff --git a/vespaclient-java/src/test/java/com/yahoo/vespafeeder/VespaFeederTestCase.java b/vespaclient-java/src/test/java/com/yahoo/vespafeeder/VespaFeederTestCase.java index 0fc0cdf017c..1122c0e9acb 100644 --- a/vespaclient-java/src/test/java/com/yahoo/vespafeeder/VespaFeederTestCase.java +++ b/vespaclient-java/src/test/java/com/yahoo/vespafeeder/VespaFeederTestCase.java @@ -47,12 +47,10 @@ public class VespaFeederTestCase { assertEquals(false, config.abortondocumenterror()); assertEquals(13.0, config.timeout(), 0.00001); assertEquals(false, config.retryenabled()); - assertEquals(12.0, config.retrydelay(), 0.0001); assertEquals("e6", config.route()); assertEquals(4, config.tracelevel()); assertEquals(false, config.abortonsenderror()); assertEquals(10, config.maxpendingdocs()); - assertEquals(11, config.maxpendingbytes()); assertEquals(29.0, config.maxfeedrate(), 0.0001); assertTrue(arguments.isVerbose()); assertFalse(config.createifnonexistent()); |